- Saved searches
- Use saved searches to filter your results more quickly
- License
- Apress/php-8-objects-patterns-practice
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- readme.md
- About
- PHP 8 Objects, Patterns, and Practice
- Table of contents (22 chapters)
- Front Matter
- Objects
- Front Matter
- PHP: Design and Management
- PHP and Objects
- Object Basics
- Advanced Features
- Object Tools
- Objects and Design
- Patterns
- Front Matter
- What Are Design Patterns? Why Use Them?
- Some Pattern Principles
- Generating Objects
- Patterns for Flexible Object Programming
- Performing and Representing Tasks
- Enterprise Patterns
- Database Patterns
- Practice
- Front Matter
- Good (and Bad) Practice
- PHP Standards
- PHP Using and Creating Components with Composer
- About this book
- Keywords
- PHP Objects, Patterns, and Practice
- Table of contents (24 chapters)
- Front Matter
- Objects
- Front Matter
- PHP: Design and Management
- PHP and Objects
- Object Basics
- Advanced Features
- Object Tools
- Objects and Design
- Patterns
- Front Matter
- What Are Design Patterns? Why Use Them?
- Some Pattern Principles
- Generating Objects
- Patterns for Flexible Object Programming
- Performing and Representing Tasks
- Enterprise Patterns
- Database Patterns
- Practice
- Front Matter
- Good (and Bad) Practice
- PHP Standards
- PHP Using and Creating Components with Composer
- About this book
- PHP Objects, Patterns and Practice
- Table of contents (21 chapters)
- Front Matter
- Introduction
- Front Matter
- PHP: Design and Management
- Objects
- Front Matter
- PHP and Object
- Object Basic
- Advanced Featurers
- Object Tools
- Object and Design
- Patterns
- Front Matter
- What are Design Pattern? Why Use Them?
- Some Pattern Principles
- Generating Object
- Pattern for Flexible Object Programming
- Performing and Representing Tasks
- Enterprise Patterns
- Database Patterns
- Practice
- Front Matter
- Good (and Bad) Practice
- An Introduction to PEAR and Pyrus
- About this book
- Keywords
- About the author
- Bibliographic Information
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Source Code for ‘PHP 8 Objects, Patterns, and Practice’ by Matt Zandstra
License
Apress/php-8-objects-patterns-practice
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
readme.md
PHP 8 Objects, Patterns, and Practice
This directory contains the source code for PHP 8 Objects, Patterns, and Practice as well as some fairly rudimentary tests.
In order to run the tests you will need to install PHPUnit. The easiest way to do this is to use composer (The composer.json and composer.lock files are also provided).
This will install PHPUnit locally. It will also configure autoload. You can then run the tests:
In the book, code examples are often presented as fragments or with details omitted. This is not the case in these files. Individual code examples are marked within runnable code using comments. For example here is an extract from src/ch13/batch01/SpaceMapper.php which contains code examples 13.16 and 13.17 . This trick allows me to unit test the examples. I use some handrolled tools to generate and embed the code examples.
selectAllStmt = $this->pdo->prepare( "SELECT * FROM space" ); $this->findByVenueStmt = $this->pdo->prepare( "SELECT * FROM space WHERE venue=?" ); /* /listing 13.16 */ > /* listing 13.17 */ public function getCollection(array $raw): SpaceCollection < return new SpaceCollection($raw, $this); >/* /listing 13.17 */ protected function doCreateObject(array $raw): Space < $obj = new Space( (int)$raw['id'], $raw['name'] ); // .
Of course, using comments makes it hard to locate an individual code example. For this reason I have included a contents file (named contents.txt ). This is also autogenerated by a production tool, and should make it a breeze to find a particular example. Here for example is an extract that shows you how to find some examples in Chapter 13:
13.13: src/ch13/batch01/Mapper.php 13.14: src/ch13/batch01/SpaceMapper.php 13.15: src/ch13/batch01/SpaceMapper.php 13.16: src/ch13/batch01/SpaceMapper.php 13.17: src/ch13/batch01/Venue.php 13.18: src/ch13/batch03/Runner.php 13.19: src/ch13/batch03/ObjectWatcher.php 13.20: src/ch13/batch03/Mapper.php 13.21: src/ch13/batch01/SpaceMapper.php
About
Source Code for 'PHP 8 Objects, Patterns, and Practice' by Matt Zandstra
PHP 8 Objects, Patterns, and Practice
This is a preview of subscription content, access via your institution.
Table of contents (22 chapters)
Front Matter
Objects
Front Matter
PHP: Design and Management
PHP and Objects
Object Basics
Advanced Features
Object Tools
Objects and Design
Patterns
Front Matter
What Are Design Patterns? Why Use Them?
Some Pattern Principles
Generating Objects
Patterns for Flexible Object Programming
Performing and Representing Tasks
Enterprise Patterns
Database Patterns
Practice
Front Matter
Good (and Bad) Practice
PHP Standards
PHP Using and Creating Components with Composer
About this book
Learn how to develop elegant and rock-solid systems using PHP, aided by three key elements: object fundamentals, design principles, and best practices. The 6th edition of this popular book has been fully updated for PHP 8, including attributes, constructor property promotion, new argument and return pseudo-types, and more. It also covers many features new since the last edition including typed properties, the null coalescing operator, and void return types. This book 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 8 Objects, Patterns, and Practice begins by covering PHP's object-oriented features. It introduces key topics including class declarations, inheritance, and reflection. The next section is devoted to design patterns. It explains the principles that make patterns powerful. You’ll cover many of the classic design patterns including 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, and how to manage builds and dependencies with Composer. It also explores strategies for automated testing and continuous integration.
After reading and using this book, you will have mastered object-oriented enhancements, design patterns, and the essential development tools available for PHP 8.
- Work with object fundamentals: write classes and methods, instantiate objects, and create 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
- Understand and use design principles to deploy objects and classes effectively in your projects
- Discover a set of powerful patterns that you can implement in your own projects
- Guarantee a successful project including unit testing; version control and build, installation, and package management; and continuous integration
Anyone with at least a basic knowledge of PHP who wants to use its object-oriented features in their projects. It is also for PHP coders who want to learn about the practices and tools (version control, testing, continuous integration, etc) that can make projects safe, elegant and stable.
Keywords
- programming
- PHP 8
- PHP
- Objects
- Design
- Patterns
- Tools
- Architecture
- Testing
- Collaboration
- language
- design
- source
- code
PHP Objects, Patterns, and Practice
This is a preview of subscription content, access via your institution.
Table of contents (24 chapters)
Front Matter
Objects
Front Matter
PHP: Design and Management
PHP and Objects
Object Basics
Advanced Features
Object Tools
Objects and Design
Patterns
Front Matter
What Are Design Patterns? Why Use Them?
Some Pattern Principles
Generating Objects
Patterns for Flexible Object Programming
Performing and Representing Tasks
Enterprise Patterns
Database Patterns
Practice
Front Matter
Good (and Bad) Practice
PHP Standards
PHP Using and Creating Components with Composer
About this book
Aided by three key elements: object fundamentals, design principles, and best practices, you'll learn how to develop elegant and rock solid systems using PHP.
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.
- 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.
- Discover a set of powerful patterns that you can deploy in your own projects.
- Guarantee a successful project including unit testing; version control, build, installation and package management; and continuous integration.
This book is suitable for anyone with at least a basic knowledge of PHP who wants to use its object-oriented features in their projects.
Those who already know their interfaces from their abstracts may well still find it hard to use these features in their systems. They will benefit from the book's emphasis on design. They will learn how to choose and combine the participants of a system; how to read design patterns and how to use them in their code.
Finally this book is for PHP coders who want to learn about the practices and tools (version control, testing, continuous integration, etc) that can make projects safe, elegant and stable.
PHP Objects, Patterns and Practice
This is a preview of subscription content, access via your institution.
Table of contents (21 chapters)
Front Matter
Introduction
Front Matter
PHP: Design and Management
Objects
Front Matter
PHP and Object
Object Basic
Advanced Featurers
Object Tools
Object and Design
Patterns
Front Matter
What are Design Pattern? Why Use Them?
Some Pattern Principles
Generating Object
Pattern for Flexible Object Programming
Performing and Representing Tasks
Enterprise Patterns
Database Patterns
Practice
Front Matter
Good (and Bad) Practice
An Introduction to PEAR and Pyrus
About this book
This book takes you beyond the PHP basics to the enterprise development practices used by professional programmers. Updated for PHP 5.3 with new sections on closures, namespaces, and continuous integration, this edition will teach you about object features such as abstract classes, reflection, interfaces, and error handling. You’ll also discover object tools to help you learn more about your classes, objects, and methods.
Then you’ll move into design patterns and the principles that make patterns powerful. You’ll learn both classic design patterns and enterprise and database patterns with easy-to-follow examples.
Finally, you’ll discover how to put it all into practice to help turn great code into successful projects. You’ll learn how to manage multiple developers with Subversion, and how to build and install using Phing and PEAR. You’ll also learn strategies for automated testing and building, including continuous integration.
Taken together, these three elements—object fundamentals, design principles, and best practices—will help you develop elegant and rock-solid systems.
Keywords
- PHP
- PHP 5
- control
- database
- management
- programming
About the author
Matt Zandstra has worked as a web programmer, consultant, and writer for nearly two decades. He is the author of SAMS Teach Yourself PHP in 24 Hours (three editions) and a contributor to DHTML Unleashed. He has written articles for Linux Magazine, Zend.com, IBM DeveloperWorks, and php|architect Magazine, among others. Matt works as a consultant advising companies on their architectures and system management, and also develops systems primarily with PHP, and Java. Matt also writes fiction.
Bibliographic Information
- Book Title : PHP Objects, Patterns and Practice
- Authors : Matt Zandstra
- DOI : https://doi.org/10.1007/978-1-4302-2926-1
- Publisher : Apress Berkeley, CA
- eBook Packages : Professional and Applied Computing , Professional and Applied Computing (R0) , Apress Access Books
- Copyright Information : Matt Zandstra 2010
- Softcover ISBN : 978-1-4302-2925-4 Published: 01 June 2010
- eBook ISBN : 978-1-4302-2926-1 Published: 28 December 2011
- Edition Number : 3
- Number of Pages : XX, 536
- Topics : Web Development , Software Engineering