The 5th edition of this popular book has been fully updated for PHP 7, including replacing the PEAR package manager with Composer, and new material on Vagrant and PHP standards. It provides a solid grounding in PHP’s support for objects, it builds on this foundation to instill core principles of software design and then covers the tools and practices needed to develop, test and deploy robust code.
PHP Objects, Patterns, and Practice begins by covering PHP’s object-oriented features. It introduces key topics including class declaration, inheritance, reflection and much more.
The next section is devoted to design patterns. It explains the principles that make patterns powerful. The book covers many of the classic design patterns and includes chapters on enterprise and database patterns.
The last segment of the book covers the tools and practices that can help turn great code into a successful project. The section shows how to manage multiple developers and releases with git, how to manage builds and dependencies with Composer. It also explores strategies for automated testing and continuous integration. Taken together these three elements: object fundamentals, design principles, and best practice will help the reader develop elegant and rock solid systems.
PHP Objects, Patterns, and Practice:
– Describes and demonstrates PHP’s built-in object-oriented features
– Breaks down the principles of object-oriented design, explaining key design patterns using practical examples.
– Discusses the tools and practices necessary for developing, testing and deploying exemplary applications.
What You’ll Learn:
– How to work with object fundamentals: writing classes and methods, instantiating objects, creating powerful class hierarchies using inheritance.
– Master advanced object-oriented features, including static methods and properties, managing error conditions with exceptions, and creating abstract classes and interfaces.
– Learn about the new object-oriented features introduced by PHP 7 and why they matter for your code.
– Understand and use design principles to deploy objects and classes effectively in your projects.
– Learn about design patterns, their purpose, structure and the underlying principles that govern them. Discover a set of powerful patterns that you can deploy in your own projects.
– Learn about the tools and practices that can guarantee a successful project including unit testing; version control, build, installation and package management; and continuous integration.
Contents at a Glance
About the Author ……………………………………………………………………………………….xxi
About the Tecnical Reviewer ……………………………………………………………………..xxiii
Acknowledgments …………………………………………………………………………………….xxv
Introduction ……………………………………………………………………………………………xxvii
Part I: Objects …………………………………………………………………………. 1
Chapter 1: PHP: Design and Management ……………………………………………………. 3
Chapter 2: PHP and Objects ……………………………………………………………………….. 9
Chapter 3: Object Basics …………………………………………………………………………. 15
Chapter 4: Advanced Features …………………………………………………………………. 47
Chapter 5: Object Tools ……………………………………………………………………………. 99
Chapter 6: Objects and Design ……………………………………………………………….. 133
Part II: Patterns …………………………………………………………………… 155
Chapter 7: What Are Design Patterns? Why Use Them? ……………………………… 157
Chapter 8: Some Pattern Principles ………………………………………………………… 165
Chapter 9: Generating Objects ………………………………………………………………… 179
Chapter 10: Patterns for Flexible Object Programming ………………………………. 211
Chapter 11: Performing and Representing Tasks ………………………………………. 235
Chapter 12: Enterprise Patterns ……………………………………………………………… 277
Chapter 13: Database Patterns ……………………………………………………………….. 327
Part III: Practice ………………………………………………………………….. 375
Chapter 14: Good (and Bad) Practice ………………………………………………………. 377
Chapter 15: PHP Standards ……………………………………………………………………. 385
Chapter 16: PHP Using and Creating Components with Composer ………………. 399
Chapter 17: Version Control with Git ……………………………………………………….. 411
Chapter 18: Testing with PHPUnit ……………………………………………………………. 435
Chapter 19: Automated Build with Phing …………………………………………………. 465
Chapter 20: Vagrant ………………………………………………………………………………. 487
Chapter 21: Continuous Integration …………………………………………………………. 497
Chapter 22: Objects, Patterns, Practice ……………………………………………………. 525
Chapter 23: Appendix A: Bibliography ……………………………………………………… 535
Chapter 24: Appendix B: A Simple Parser ………………………………………………… 539
Index ……………………………………………………………………………………………………… 565