Mastering PHP 7

Effective, readable, and robust codes in PHP

Mastering PHP 7

This ebook is included in a Mapt subscription
Branko Ajzele

Effective, readable, and robust codes in PHP
$10.00
$44.99
RRP $35.99
RRP $44.99
eBook
Print + eBook
Access every Packt eBook & Video for just $100
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Find Out More
 
Code Files
Preview in Mapt

Book Details

ISBN 139781785882814
Paperback536 pages

Book Description

PHP 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 practically

The 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.

Table of Contents

Chapter 1: The All New PHP
Scalar type hints
Return type hints
Anonymous classes
Generator delegation
Generator return expressions
The null coalesce operator
The spaceship operator
Constant arrays
Uniform variable syntax
Throwables
Group use declarations
Catching multiple exceptions types
Class constant visibility modifiers
Iterable pseudo-type
Nullable types
Void return types
Summary
Chapter 2: Embracing Standards
PSR-1 - basic coding standard
PSR-2 - coding style guide
PSR-3 - logger interface
PSR-4 - autoloading standard
PSR-6 - caching interface
PSR-7 - HTTP message interface
PSR-13 - hypermedia links
Summary
Chapter 3: Error Handling and Logging
Error handling
Logging
Summary
Chapter 4: Magic Behind Magic Methods
Using __construct()
Using __destruct()
Using __call()
Using __callStatic()
Using __set()
Using __get()
Using __isset()
Using __unset()
Using __sleep()
Using __wakeup()
Using __toString()
Using __invoke()
Using __set_state()
Using __clone()
Using __debugInfo()
Usage statistics across popular platforms
Summary
Chapter 5: The Realm of CLI
Understanding PHP CLI
The Console component
Input/output streams
Process control
Summary
Chapter 6: Prominent OOP Features
Object inheritance
Objects and references
Object iteration
Object comparison
Traits
Reflection
Summary
Chapter 7: Optimizing for High Performance
Max execution time
Memory management
File uploads
Session handling
Output buffering
Disabling debug messages
Zend OPcache
Concurrency
Summary
Chapter 8: Going Serverless
Using the serverless framework
Using Iron.io IronWorker
Summary
Chapter 9: Reactive Programming
Similarities with event-driven programming
Using RxPHP
Non-blocking IO
Using React
Summary
Chapter 10: Common Design Patterns
Base patterns
Creational patterns
Behavioral patterns
Structural patterns
Summary
Chapter 11: Building Services
Understanding the client-server relationship
Working with SOAP
Working with REST
Working with Apache Thrift (RPC)
Understanding microservices
Summary
Chapter 12: Working with Databases
Working with MySQL
Working with MongoDB
Working with Redis
Summary
Chapter 13: Resolving Dependencies
Mitigating the common problem
Understanding dependency injection
Understanding dependency injection container
Summary
Chapter 14: Working with Packages
Understanding Composer
Understanding Packagist
Using third-party packages
Creating your own package
Distributing your package
Summary
Chapter 15: Testing the Important Bits
PHPUnit
Behat
phpspec
jMeter
Summary
Chapter 16: Debugging, Tracing, and Profiling
Xdebug
Zend Z-Ray
Summary
Chapter 17: Hosting, Provisioning, and Deployment
Choosing the right hosting plan
Automating provisioning
Automating the deployment
Continuous integration
Summary

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 profiling

Authors

Table of Contents

Chapter 1: The All New PHP
Scalar type hints
Return type hints
Anonymous classes
Generator delegation
Generator return expressions
The null coalesce operator
The spaceship operator
Constant arrays
Uniform variable syntax
Throwables
Group use declarations
Catching multiple exceptions types
Class constant visibility modifiers
Iterable pseudo-type
Nullable types
Void return types
Summary
Chapter 2: Embracing Standards
PSR-1 - basic coding standard
PSR-2 - coding style guide
PSR-3 - logger interface
PSR-4 - autoloading standard
PSR-6 - caching interface
PSR-7 - HTTP message interface
PSR-13 - hypermedia links
Summary
Chapter 3: Error Handling and Logging
Error handling
Logging
Summary
Chapter 4: Magic Behind Magic Methods
Using __construct()
Using __destruct()
Using __call()
Using __callStatic()
Using __set()
Using __get()
Using __isset()
Using __unset()
Using __sleep()
Using __wakeup()
Using __toString()
Using __invoke()
Using __set_state()
Using __clone()
Using __debugInfo()
Usage statistics across popular platforms
Summary
Chapter 5: The Realm of CLI
Understanding PHP CLI
The Console component
Input/output streams
Process control
Summary
Chapter 6: Prominent OOP Features
Object inheritance
Objects and references
Object iteration
Object comparison
Traits
Reflection
Summary
Chapter 7: Optimizing for High Performance
Max execution time
Memory management
File uploads
Session handling
Output buffering
Disabling debug messages
Zend OPcache
Concurrency
Summary
Chapter 8: Going Serverless
Using the serverless framework
Using Iron.io IronWorker
Summary
Chapter 9: Reactive Programming
Similarities with event-driven programming
Using RxPHP
Non-blocking IO
Using React
Summary
Chapter 10: Common Design Patterns
Base patterns
Creational patterns
Behavioral patterns
Structural patterns
Summary
Chapter 11: Building Services
Understanding the client-server relationship
Working with SOAP
Working with REST
Working with Apache Thrift (RPC)
Understanding microservices
Summary
Chapter 12: Working with Databases
Working with MySQL
Working with MongoDB
Working with Redis
Summary
Chapter 13: Resolving Dependencies
Mitigating the common problem
Understanding dependency injection
Understanding dependency injection container
Summary
Chapter 14: Working with Packages
Understanding Composer
Understanding Packagist
Using third-party packages
Creating your own package
Distributing your package
Summary
Chapter 15: Testing the Important Bits
PHPUnit
Behat
phpspec
jMeter
Summary
Chapter 16: Debugging, Tracing, and Profiling
Xdebug
Zend Z-Ray
Summary
Chapter 17: Hosting, Provisioning, and Deployment
Choosing the right hosting plan
Automating provisioning
Automating the deployment
Continuous integration
Summary

Book Details

ISBN 139781785882814
Paperback536 pages
Read More

Read More Reviews