PHP 7 Programming Cookbook

Over 80 recipes that will take your PHP 7 web development skills to the next level!
Preview in Mapt

PHP 7 Programming Cookbook

Doug Bierer

1 customer reviews
Over 80 recipes that will take your PHP 7 web development skills to the next level!
Mapt Subscription
FREE
$29.99/m after trial
eBook
$10.00
RRP $39.99
Save 74%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$10.00
$49.99
$29.99 p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


PHP 7 Programming Cookbook Book Cover
PHP 7 Programming Cookbook
$ 39.99
$ 10.00
Robot Operating System Cookbook Book Cover
Robot Operating System Cookbook
$ 39.99
$ 10.00
Buy 2 for $20.00
Save $59.98
Add to Cart

Book Details

ISBN 139781785883446
Paperback610 pages

Book Description

PHP 7 comes with a myriad of new features and great tools to optimize your code and make your code perform faster than in previous versions. Most importantly, it allows you to maintain high traffic on your websites with low-cost hardware and servers through a multithreading web server.

This book demonstrates intermediate to advanced PHP techniques with a focus on PHP 7. Each recipe is designed to solve practical, real-world problems faced by PHP developers like yourself every day. We also cover new ways of writing PHP code made possible only in version 7. In addition, we discuss backward-compatibility breaks and give you plenty of guidance on when and where PHP 5 code needs to be changed to produce the correct results when running under PHP 7. This book also incorporates the latest PHP 7.x features.

By the end of the book, you will be equipped with the tools and skills required to deliver efficient applications for your websites and enterprises.

Table of Contents

Chapter 1: Building a Foundation
Introduction
PHP 7 installation considerations
Using the built-in PHP web server
Defining a test MySQL database
Installing PHPUnit
Implementing class autoloading
Hoovering a website
Building a deep web scanner
Creating a PHP 5 to PHP 7 code converter
Chapter 2: Using PHP 7 High Performance Features
Introduction
Understanding the abstract syntax tree
Understanding differences in parsing
Understanding differences in foreach() handling
Improving performance using PHP 7 enhancements
Iterating through a massive file
Uploading a spreadsheet into a database
Recursive directory iterator
Chapter 3: Working with PHP Functional Programming
Introduction
Developing functions
Hinting at data types
Using return value data typing
Using iterators
Writing your own iterator using generators
Chapter 4: Working with PHP Object-Oriented Programming
Introduction
Developing classes
Extending classes
Using static properties and methods
Using namespaces
Defining visibility
Using interfaces
Using traits
Implementing anonymous classes
Chapter 5: Interacting with a Database
Introduction
Using PDO to connect to a database
Building an OOP SQL query builder
Handling pagination
Defining entities to match database tables
Tying entity classes to RDBMS queries
Embedding secondary lookups into query results
Implementing jQuery DataTables PHP lookups
Chapter 6: Building Scalable Websites
Introduction
Creating a generic form element generator
Creating an HTML radio element generator
Creating an HTML select element generator
Implementing a form factory
Chaining $_POST filters
Chaining $_POST validators
Tying validation to a form
Chapter 7: Accessing Web Services
Introduction
Converting between PHP and XML
Creating a simple REST client
Creating a simple REST server
Creating a simple SOAP client
Creating a simple SOAP server
Chapter 8: Working with Date/Time and International Aspects
Introduction
Using emoticons or emoji in a view script
Converting complex characters
Getting the locale from browser data
Formatting numbers by locale
Handling currency by locale
Formatting date/time by locale
Creating an HTML international calendar generator
Building a recurring events generator
Handling translation without gettext
Chapter 9: Developing Middleware
Introduction
Authenticating with middleware
Using middleware to implement access control
Improving performance using the cache
Implementing routing
Making inter-framework system calls
Using middleware to cross languages
Chapter 10: Looking at Advanced Algorithms
Introduction
Using getters and setters
Implementing a linked list
Building a bubble sort
Implementing a stack
Building a binary search class
Implementing a search engine
Displaying a multi-dimensional array and accumulating totals
Chapter 11: Implementing Software Design Patterns
Introduction
Creating an array to object hydrator
Building an object to array hydrator
Implementing a strategy pattern
Defining a mapper
Implementing object-relational mapping
Implementing the Pub/Sub design pattern
Chapter 12: Improving Web Security
Introduction
Filtering $_POST data
Validating $_POST data
Safeguarding the PHP session
Securing forms with a token
Building a secure password generator
Safeguarding forms with a CAPTCHA
Encrypting/decrypting without mcrypt
Chapter 13: Best Practices, Testing, and Debugging
Introduction
Using Traits and Interfaces
Universal exception handler
Universal error handler
Writing a simple test
Writing a test suite
Generating fake test data
Customizing sessions using session_start parameters

What You Will Learn

  • Use advanced PHP 7 features, such as the Abstract Syntax Tree, Uniform Variable Syntax, Scalar Type Hints, Generator Delegation, Anonymous Classes, and the Context Sensitive Lexer
  • Discover where and when PHP 5 code needs to be re-written to avoid backwards-compatibility breaks
  • Improve the overall application security and error handling by taking advantage of classes that implement the new throwable interface
  • Solve practical real-world programming problems using PHP 7
  • Develop middle-wareclasses that allow PHP developers to gluedifferent open source libraries together seamlessly
  • Define and Implement PSR-7 classes
  • Create custom middleware using PSR-7 compliant classes
  • Test and debug your code, and get to know the best practices

Authors

Table of Contents

Chapter 1: Building a Foundation
Introduction
PHP 7 installation considerations
Using the built-in PHP web server
Defining a test MySQL database
Installing PHPUnit
Implementing class autoloading
Hoovering a website
Building a deep web scanner
Creating a PHP 5 to PHP 7 code converter
Chapter 2: Using PHP 7 High Performance Features
Introduction
Understanding the abstract syntax tree
Understanding differences in parsing
Understanding differences in foreach() handling
Improving performance using PHP 7 enhancements
Iterating through a massive file
Uploading a spreadsheet into a database
Recursive directory iterator
Chapter 3: Working with PHP Functional Programming
Introduction
Developing functions
Hinting at data types
Using return value data typing
Using iterators
Writing your own iterator using generators
Chapter 4: Working with PHP Object-Oriented Programming
Introduction
Developing classes
Extending classes
Using static properties and methods
Using namespaces
Defining visibility
Using interfaces
Using traits
Implementing anonymous classes
Chapter 5: Interacting with a Database
Introduction
Using PDO to connect to a database
Building an OOP SQL query builder
Handling pagination
Defining entities to match database tables
Tying entity classes to RDBMS queries
Embedding secondary lookups into query results
Implementing jQuery DataTables PHP lookups
Chapter 6: Building Scalable Websites
Introduction
Creating a generic form element generator
Creating an HTML radio element generator
Creating an HTML select element generator
Implementing a form factory
Chaining $_POST filters
Chaining $_POST validators
Tying validation to a form
Chapter 7: Accessing Web Services
Introduction
Converting between PHP and XML
Creating a simple REST client
Creating a simple REST server
Creating a simple SOAP client
Creating a simple SOAP server
Chapter 8: Working with Date/Time and International Aspects
Introduction
Using emoticons or emoji in a view script
Converting complex characters
Getting the locale from browser data
Formatting numbers by locale
Handling currency by locale
Formatting date/time by locale
Creating an HTML international calendar generator
Building a recurring events generator
Handling translation without gettext
Chapter 9: Developing Middleware
Introduction
Authenticating with middleware
Using middleware to implement access control
Improving performance using the cache
Implementing routing
Making inter-framework system calls
Using middleware to cross languages
Chapter 10: Looking at Advanced Algorithms
Introduction
Using getters and setters
Implementing a linked list
Building a bubble sort
Implementing a stack
Building a binary search class
Implementing a search engine
Displaying a multi-dimensional array and accumulating totals
Chapter 11: Implementing Software Design Patterns
Introduction
Creating an array to object hydrator
Building an object to array hydrator
Implementing a strategy pattern
Defining a mapper
Implementing object-relational mapping
Implementing the Pub/Sub design pattern
Chapter 12: Improving Web Security
Introduction
Filtering $_POST data
Validating $_POST data
Safeguarding the PHP session
Securing forms with a token
Building a secure password generator
Safeguarding forms with a CAPTCHA
Encrypting/decrypting without mcrypt
Chapter 13: Best Practices, Testing, and Debugging
Introduction
Using Traits and Interfaces
Universal exception handler
Universal error handler
Writing a simple test
Writing a test suite
Generating fake test data
Customizing sessions using session_start parameters

Book Details

ISBN 139781785883446
Paperback610 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

PHP 7 Programming Blueprints Book Cover
PHP 7 Programming Blueprints
$ 35.99
$ 10.00
Mastering PHP Design Patterns Book Cover
Mastering PHP Design Patterns
$ 35.99
$ 10.00
PHP 7: Real World Application Development Book Cover
PHP 7: Real World Application Development
$ 69.99
$ 10.00
Modular Programming with PHP 7 Book Cover
Modular Programming with PHP 7
$ 39.99
$ 10.00
PHP 7 Data Structures and Algorithms Book Cover
PHP 7 Data Structures and Algorithms
$ 35.99
$ 10.00
AngularJS Web Application Development Blueprints Book Cover
AngularJS Web Application Development Blueprints
$ 29.99
$ 10.00