Mastering PHP 7
eBook - ePub

Mastering PHP 7

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

Mastering PHP 7

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

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

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

  1. Title Page
  2. Copyright
  3. Credits
  4. About the Author
  5. About the Reviewers
  6. www.PacktPub.com
  7. Customer Feedback
  8. Preface
  9. The All New PHP
  10. Embracing Standards
  11. Error Handling and Logging
  12. Magic Behind Magic Methods
  13. The Realm of CLI
  14. Prominent OOP Features
  15. Optimizing for High Performance
  16. Going Serverless
  17. Reactive Programming
  18. Common Design Patterns
  19. Building Services
  20. Working with Databases
  21. Resolving Dependencies
  22. Working with Packages
  23. Testing the Important Bits
  24. Debugging, Tracing, and Profiling
  25. Hosting, Provisioning, and Deployment

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
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 990+ topics, we’ve got you covered! Learn about our mission
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 about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Mastering PHP 7 by Branko Ajzele in PDF and/or ePUB format, as well as other popular books in Computer Science & Databases. We have over one million books available in our catalogue for you to explore.