Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
The Art of Modern PHP 8

You're reading from  The Art of Modern PHP 8

Product type Book
Published in Oct 2021
Publisher Packt
ISBN-13 9781800566156
Pages 420 pages
Edition 1st Edition
Languages
Author (1):
Joseph Edmonds Joseph Edmonds
Profile icon Joseph Edmonds

Table of Contents (19) Chapters

Preface 1. Section 1 – PHP 8 OOP
2. Chapter 1: Object-Oriented PHP 3. Chapter 2: Inheritance and Composition, Encapsulation and Visibility, Interfaces and Concretions 4. Chapter 3: Advanced OOP Features 5. Section 2 – PHP Types
6. Chapter 4: Scalar, Arrays, and Special Types 7. Chapter 5: Object Types, Interfaces, and Unions 8. Chapter 6: Parameter, Property, and Return Types 9. Section 3 – Clean PHP 8 Patterns and Style
10. Chapter 7: Design Patterns and Clean Code 11. Chapter 8: Model, View, Controller (MVC) Example 12. Chapter 9: Dependency Injection Example 13. Section 4 – PHP 8 Composer Package Management (and PHP 8.1)
14. Chapter 10: Composer For Dependencies 15. Chapter 11: Creating Your Own Composer Package 16. Section 5 – Bonus Section - PHP 8.1
17. Chapter 12: The Awesomeness That Is 8.1 18. Other Books You May Enjoy

What this book covers

Chapter 1, Object-Oriented PHP, includes a quick overview of what OOP means and how it contrasts with functional and procedural styles. We review some popular OOP PHP projects that you might want to have a look at and then we go over the basics of classes, objects, interfaces, and namespaces.

Chapter 2, Inheritance and Composition, Encapsulation and Visibility, Interfaces and Concretions, following the theme of looking at OOP, explores inheritance in some detail and then contrasts this with a more modern approach of using composition. You are encouraged to download the code in order to get the most out of this chapter.

Chapter 3, Advanced OOP Features, the third and final chapter in Section 1, continues looking at OOP, and this time we're looking at the SPL (Standard PHP Library), exceptions and error handling, and finally meta-programming with reflection and attributes.

Chapter 4, Scalar, Arrays, and Special Types, explains that since PHP 7, types have become a major feature in modern PHP. This chapter looks at the simpler types, including scalars, arrays, and iterables, and then the "nothing" types of null, void, and uninitialized.

Chapter 5, Object Types, Interfaces, and Unions, continues looking at types, but our focus shifts onto looking at exactly how the type system works when dealing with classes and interfaces.

Chapter 6, Parameter, Property, and Return Types, the final chapter in Section 2, looks at how types can be enforced strictly and examines their usage as parameter, property, and return types. We conclude by looking at covariance and contravariance and confirm how this works in PHP 8.

Chapter 7, Design Patterns and Clean Code, moves on from learning about the language itself and starts to look at ways we write it. We look at some clean coding practices and then have an overview of design patterns that are tried and tested approaches to common requirements.

Chapter 8, Model, View, Controller (MVC) Example, sees us work through the MVC pattern by building a toy MVC system. You are definitely encouraged to download the code for this chapter.

Chapter 9, Dependency Injection Example, as in Chapter 8, Model, View, Controller (MVC) Example, looks to learn by doing, and this time our goal is to understand all about DI. We will create an entire toy DI container to understand how this pattern works.

Chapter 10, Composer for Dependencies, introduces Composer—one of the most important things to happen in the PHP world. We will learn how to use Composer to use third-party packages in our projects.

Chapter 11, Creating Your Own Composer Package, continues with Composer but this time looks at how we can use it to create our own packages, share them with our private projects, and even publish them for the benefit of the PHP community.

Chapter 12, The Awesomeness That Is 8.1, the final chapter of the book, is all about PHP 8.1 and the excellent new features that are included in this new release. It is not an exhaustive list but instead focuses on a selection of features that are most likely to matter to you day to day.

lock icon The rest of the chapter is locked
Next Chapter arrow right
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}