Mastering PHP 7
eBook - ePub

Mastering PHP 7

Branko Ajzele

Share book
  1. 536 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering PHP 7

Branko Ajzele

Book details
Book preview
Table of contents
Citations

About This Book

Effective, readable, and robust codes in PHPAbout This Book• Leverage the newest tools available in PHP 7 to build scalable applications• Embrace serverless architecture and the reactive programming paradigm, which are the latest additions to the PHP ecosystem• Explore dependency injection and implement design patterns to write elegant codeWho This Book Is ForThis book is for intermediate level developers who want to become a master of PHP. Basic knowledge of PHP is required across areas such as basic syntax, types, variables, constants, expressions, operators, control structures, and functions.What You Will Learn• Grasp the current state of PHP language and the PHP standards• Effectively implement logging and error handling during development• Build services through SOAP and REST and Apache Trift• Get to know the benefits of serverless architecture• Understand the basic principles of reactive programming to write asynchronous code• Practically implement several important design patterns• Write efficient code by executing dependency injection• See the working of all magic methods• Handle the command-line area tools and processes• Control the development process with proper debugging and profilingIn DetailPHP is a server-side scripting language that is widely used for web development. With this book, you will get a deep understanding of the advanced programming concepts in PHP and how to apply it practicallyThe book starts by unveiling the new features of PHP 7 and walks you through several important standards set by PHP Framework Interop Group (PHP-FIG). You'll see, in detail, the working of all magic methods, and the importance of effective PHP OOP concepts, which will enable you to write effective PHP code. You will find out how to implement design patterns and resolve dependencies to make your code base more elegant and readable. You will also build web services alongside microservices architecture, interact with databases, and work around third-party packages to enrich applications. This book delves into the details of PHP performance optimization. You will learn about serverless architecture and the reactive programming paradigm that found its way in the PHP ecosystem. The book also explores the best ways of testing your code, debugging, tracing, profiling, and deploying your PHP application.By the end of the book, you will be able to create readable, reliable, and robust applications in PHP to meet modern day requirements in the software industry.Style and approachThis is a comprehensive, step-by-step practical guide to developing scalable applications using PHP 7.1

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering PHP 7 an online PDF/ePUB?
Yes, you can access Mastering PHP 7 by Branko Ajzele in PDF and/or ePUB format, as well as other popular books in Informatica & Programmazione in PHP. We have over one million books available in our catalogue for you to explore.

Information

Year
2017
ISBN
9781785889943

Working with Databases

The PHP language has a pretty good support for several different databases. MySQL has been embraced by PHP developers as the go-to database ever since the early days of the PHP language. While the initial emphasis was mostly on relational database management systems (RDBMS), other types of databases proved to be equally (or more) important for modern applications. The document and data key-value databases have been growing in popularity ever since.
Nowadays, it is not uncommon to see a PHP application making use of MySQL, Mongo, Redis, and possibly a few more databases or data stores all at once.
The NoSQL ("non SQL", "non relational" or "not only SQL") nature of Mongo allows building applications that generate massive volumes of new and possibly rapidly changing data types. Relieved from the strictness of SQL (Structured Query Language), working with structured, semi-structured, unstructured, and polymorphic data becomes a whole new experience with the Mongo database. The in-memory data structure stores such as Redis strive on speed, which makes them great to cache and message broker systems.
In this chapter, we will take a closer look at MySQL, Mongo, and Redis through the following sections:
  • Working with MySQL
    • Installing MySQL
    • Setting up sample data
    • Querying via the mysqli driver extension
    • Querying via the PHP Data Objects driver extension
  • Working with MongoDB
    • Installing MongoDB
    • Setting up sample data
    • Querying via the MongoDB driver extension
  • Working with Redis
    • Installing Redis
    • Setting up sample data
    • Querying via the phpredis driver extension
Throughout this chapter, we provide quick installation instructions for each of the three database servers. These instructions are given on a relatively basic level, without any post-installation configuration or tuning that is usually done on production-type machines. The general idea here was to merely get the developer machine up and running with each of the database servers.

Working with MySQL

MySQL is an open source RDBMS that has been around for over 20 years now. Originally developed and owned by the Swedish company MySQL AB, it is now owned by Oracle Corporation. The current stable version of MySQL is 5.7.
Some of the key strengths of MySQL can be outlined as follows:
  • Cross-platform, runs on server
  • Can be used for desktop and web applications
  • Fast, reliable, and easy to use
  • Good for small and large applications
  • Uses standard SQL
  • Supports query caching
  • Supports Unicode
  • ACID compliance when using InnoDB
  • Transactions wh...

Table of contents