Muutke küpsiste eelistusi

PHP 8 Objects, Patterns, and Practice: Mastering OO Enhancements, Design Patterns, and Essential Development Tools Sixth Edition [Pehme köide]

  • Formaat: Paperback / softback, 833 pages, kõrgus x laius: 254x178 mm, kaal: 1606 g, 102 Illustrations, black and white; XXV, 833 p. 102 illus., 1 Paperback / softback
  • Ilmumisaeg: 03-Apr-2021
  • Kirjastus: APress
  • ISBN-10: 1484267907
  • ISBN-13: 9781484267905
Teised raamatud teemal:
  • Pehme köide
  • Hind: 84,24 €*
  • * saadame teile pakkumise kasutatud raamatule, mille hind võib erineda kodulehel olevast hinnast
  • See raamat on trükist otsas, kuid me saadame teile pakkumise kasutatud raamatule.
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 833 pages, kõrgus x laius: 254x178 mm, kaal: 1606 g, 102 Illustrations, black and white; XXV, 833 p. 102 illus., 1 Paperback / softback
  • Ilmumisaeg: 03-Apr-2021
  • Kirjastus: APress
  • ISBN-10: 1484267907
  • ISBN-13: 9781484267905
Teised raamatud teemal:

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. 

What You Will Learn

  • 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

Who This Book Is For

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.

About the Author xix
About the Technical Reviewer xxi
Acknowledgments xxiii
Introduction xxv
Part I: Objects 1(238)
Chapter 1 PHP: Design and Management
3(10)
The Problem
3(2)
PHP and Other Languages
5(3)
About This Book
8(3)
Objects
8(1)
Patterns
9(1)
Practice
9(2)
What's New in the Sixth Edition
11(1)
Summary
11(2)
Chapter 2 PHP and Objects
13(8)
The Accidental Success of PHP Objects
13(6)
In the Beginning: PHP/FI
13(1)
Syntactic Sugar: PHP 3
14(1)
PHP 4 and the Quiet Revolution
14(3)
Change Embraced: PHP 5
17(1)
PHP 7: Closing the Gap
18(1)
PHP 8: The Consolidation Continues
19(1)
Advocacy and Agnosticism: The Object Debate
19(1)
Summary
20(1)
Chapter 3 Object Basics
21(58)
Classes and Objects
21(3)
A First Class
21(1)
A First Object (or Two)
22(2)
Setting Properties in a Class
24(3)
Working with Methods
27(2)
Creating a Constructor Method
29(4)
Constructor Property Promotion
31(2)
Default Arguments and Named Arguments
33(1)
Arguments and Types
34(16)
Primitive Types
35(4)
Some Other Type-Checking Functions
39(1)
Type Declarations: Object Types
40(3)
Type Declarations: Primitive Types
43(2)
mixed Types
45(2)
Union Types
47(3)
Nullable Types
50(1)
Return Type Declarations
50(1)
Inheritance
51(26)
The Inheritance Problem
52(7)
Working with Inheritance
59(8)
Public, Private, and Protected: Managing Access to Your Classes
67(4)
Typed Properties
71(6)
Summary
77(2)
Chapter 4 Advanced Features
79(74)
Static Methods and Properties
79(6)
Constant Properties
85(1)
Abstract Classes
86(3)
Interfaces
89(3)
Traits
92(13)
A Problem for Traits to Solve
93(1)
Defining and Using a Trait
94(1)
Using More Than One Trait
95(2)
Combining Traits and Interfaces
97(1)
Managing Method Name Conflicts with insteadof
98(1)
Aliasing Overridden Trait Methods
99(1)
Using Static Methods in Traits
100(1)
Accessing Host Class Properties
101(1)
Defining Abstract Methods in Traits
102(2)
Changing Access Rights to Trait Methods
104(1)
Late Static Bindings: The static Keyword
105(4)
Handling Errors
109(13)
Exceptions
112(10)
Final Classes and Methods
122(2)
The Internal Error Class
124(1)
Working with Interceptors
125(9)
Defining Destructor Methods
134(2)
Copying Objects with _clone()
136(4)
Defining String Values for Your Objects
140(2)
Callbacks, Anonymous Functions, and Closures
142(8)
Anonymous Classes
150(2)
Summary
152(1)
Chapter 5 Object Tools
153(56)
PHP and Packages
153(19)
PHP Packages and Namespaces
154(13)
Autoload
167(5)
The Class and Object Functions
172(13)
Looking for Classes
174(1)
Learning About an Object or Class
175(2)
Getting a Fully Qualified String Reference to a Class
177(1)
Learning About Methods
178(3)
Learning About Properties
181(1)
Learning About Inheritance
181(1)
Method Invocation
182(3)
The Reflection API
185(17)
Getting Started
185(1)
Time to Roll Up Your Sleeves
186(3)
Examining a Class
189(2)
Examining Methods
191(3)
Examining Method Arguments
194(3)
Using the Reflection API
197(5)
Attributes
202(6)
Summary
208(1)
Chapter 6 Objects and Design
209(30)
Defining Code Design
209(1)
Object-Oriented and Procedural Programming
210(8)
Responsibility
216(1)
Cohesion
217(1)
Coupling
217(1)
Orthogonality
217(1)
Choosing Your Classes
218(1)
Polymorphism
219(2)
Encapsulation
221(2)
Forget How to Do It
223(1)
Four Signposts
224(1)
Code Duplication
224(1)
The Class Who Knew Too Much
224(1)
The Jack of All Trades
225(1)
Conditional Statements
225(1)
The UML
225(13)
Class Diagrams
226(9)
Sequence Diagrams
235(3)
Summary
238(1)
Part II: Patterns 239(318)
Chapter 7 What Are Design Patterns? Why Use Them?
241(12)
What Are Design Patterns?
241(3)
A Design Pattern Overview
244(2)
Name
244(1)
The Problem
245(1)
The Solution
245(1)
Consequences
246(1)
The Gang of Four Format
246(1)
Why Use Design Patterns?
247(3)
A Design Pattern Defines a Problem
247(1)
A Design Pattern Defines a Solution
248(1)
Design Patterns Are Language Independent
248(1)
Patterns Define a Vocabulary
248(1)
Patterns Are Tried and Tested
249(1)
Patterns Are Designed for Collaboration
249(1)
Design Patterns Promote Good Design
250(1)
Design Patterns Are Used by Popular Frameworks
250(1)
PHP and Design Patterns
250(1)
Summary
251(2)
Chapter 8 Some Pattern Principles
253(20)
The Pattern Revelation
253(1)
Composition and Inheritance
254(8)
The Problem
254(4)
Using Composition
258(4)
Decoupling
262(5)
The Problem
262(2)
Loosening Your Coupling
264(3)
Code to an Interface, Not to an Implementation
267(2)
The Concept That Varies
269(1)
Patternitis
270(1)
The Patterns
270(1)
Patterns for Generating Objects
271(1)
Patterns for Organizing Objects and Classes
271(1)
Task-Oriented Patterns
271(1)
Enterprise Patterns
271(1)
Database Patterns
271(1)
Summary
271(2)
Chapter 9 Generating Objects
273(58)
Problems and Solutions in Generating Objects
273(7)
The Singleton Pattern
280(5)
The Problem
280(1)
Implementation
281(3)
Consequences
284(1)
Factory Method Pattern
285(8)
The Problem
285(4)
Implementation
289(3)
Consequences
292(1)
Abstract Factory Pattern
293(7)
The Problem
293(2)
Implementation
295(3)
Consequences
298(2)
Prototype
300(7)
The Problem
301(1)
Implementation
302(5)
Pushing to the Edge: Service Locator
307(2)
Splendid Isolation: Dependency Injection
309(21)
The Problem
309(1)
Implementation
310(18)
Consequences
328(2)
Summary
330(1)
Chapter 10 Patterns for Flexible Object Programming
331(32)
Structuring Classes to Allow Flexible Objects
331(1)
The Composite Pattern
332(15)
The Problem
332(4)
Implementation
336(6)
Consequences
342(5)
Composite in Summary
347(1)
The Decorator Pattern
347(10)
The Problem
347(3)
Implementation
350(6)
Consequences
356(1)
The Facade Pattern
357(5)
The Problem
357(3)
Implementation
360(1)
Consequences
361(1)
Summary
362(1)
Chapter 11 Performing and Representing Tasks
363(58)
The Interpreter Pattern
363(14)
The Problem
364(1)
Implementation
365(12)
Interpreter Issues
377(1)
The Strategy Pattern
377(6)
The Problem
377(2)
Implementation
379(4)
The Observer Pattern
383(12)
Implementation
387(8)
The Visitor Pattern
395(10)
The Problem
395(3)
Implementation
398(7)
Visitor Issues
405(1)
The Command Pattern
405(8)
The Problem
406(1)
Implementation
406(7)
The Null Object Pattern
413(6)
The Problem
414(3)
Implementation
417(2)
Summary
419(2)
Chapter 12 Enterprise Patterns
421(70)
Architecture Overview
422(4)
The Patterns
422(1)
Applications and Layers
423(3)
Cheating Before We Start
426(8)
Registry
426(2)
Implementation
428(6)
The Presentation Layer
434(45)
Front Controller
435(15)
Application Controller
450(18)
Page Controller
468(7)
Template View and View Helper
475(4)
The Business Logic Layer
479(11)
Transaction Script
479(6)
Domain Model
485(5)
Summary
490(1)
Chapter 13 Database Patterns
491(66)
The Data Layer
491(1)
Data Mapper
492(22)
The Problem
492(1)
Implementation
493(20)
Consequences
513(1)
Identity Map
514(6)
The Problem
514(2)
Implementation
516(4)
Consequences
520(1)
Unit of Work
520(12)
The Problem
521(1)
Implementation
521(7)
Consequences
528(1)
Lazy Load
528(1)
The Problem
528(1)
Implementation
529(2)
Consequences
531(1)
Domain Object Factory
532(4)
The Problem
532(1)
Implementation
532(2)
Consequences
534(2)
The Identity Object
536(9)
The Problem
536(1)
Implementation
537(8)
Consequences
545(1)
The Selection Factory and Update Factory Patterns
545(7)
The Problem
545(1)
Implementation
546(5)
Consequences
551(1)
What's Left of Data Mapper Now?
552(3)
Summary
555(2)
Part III: Practice 557(224)
Chapter 14 Good (and Bad) Practice
559(12)
Beyond Code
560(1)
Borrowing a Wheel
560(3)
Playing Nice
563(1)
Giving Your Code Wings
564(1)
Standards
565(1)
Vagrant
566(1)
Testing
567(1)
Continuous Integration
568(1)
Summary
569(2)
Chapter 15 PHP Standards
571(24)
Why Standards?
571(1)
What Are PHP Standards Recommendations?
572(3)
Why PSR in Particular?
573(1)
Who Are PSRs for?
574(1)
Coding with Style
575(14)
PSR-1 Basic Coding Standard
575(4)
PSR-12 Extended Coding Style
579(7)
Checking and Fixing Your Code
586(3)
PSR-4 Autoloading
589(4)
The Rules That Matter to Us
589(4)
Summary
593(2)
Chapter 16 PHP Using and Creating Components with Composer
595(18)
What Is Composer?
596(1)
Installing Composer
596(1)
Installing a (Set of) Package(s)
596(6)
Installing a Package from the Command Line
598(1)
Versions
598(2)
require-dev
600(2)
Composer and Autoload
602(1)
Creating Your Own Package
603(2)
Adding Package Information
603(1)
Platform Packages
604(1)
Distribution Through Packagist
605(4)
Keeping It Private
609(2)
Summary
611(2)
Chapter 17 Version Control with Git
613(32)
Why Use Version Control?
613(2)
Getting Git
615(1)
Using an Online Git Repository
616(2)
Configuring a Git Server
618(3)
Creating the Remote Repository
619(2)
Beginning a Project
621(5)
Cloning the Repository
625(1)
Updating and Committing
626(4)
Adding and Removing Files and Directories
630(3)
Adding a File
631(1)
Removing a File
631(1)
Adding a Directory
632(1)
Removing Directories
633(1)
Tagging a Release
633(1)
Branching a Project
634(10)
Summary
644(1)
Chapter 18 Testing with PHPUnit
645(42)
Functional Tests and Unit Tests
646(1)
Testing by Hand
646(4)
Introducing PHPUnit
650(20)
Creating a Test Case
651(3)
Assertion Methods
654(1)
Testing Exceptions
655(1)
Running Test Suites
656(1)
Constraints
657(3)
Mocks and Stubs
660(4)
Tests Succeed When They Fail
664(6)
Writing Web Tests
670(14)
Refactoring a Web Application for Testing
670(3)
Simple Web Testing
673(3)
Introducing Selenium
676(8)
A Note of Caution
684(2)
Summary
686(1)
Chapter 19 Automated Build with Phing
687(32)
What Is Phing?
688(1)
Getting and Installing Phing
689(1)
Composing the Build Document
689(28)
Targets
692(3)
Properties
695(9)
Types
704(7)
Tasks
711(6)
Summary
717(2)
Chapter 20 Vagrant
719(14)
The Problem
719(1)
A Little Setup
720(3)
Choosing and Installing a Vagrant Box
721(2)
Mounting Local Directories on the Vagrant Box
723(2)
Provisioning
725(6)
Setting Up the Web Server
727(1)
Setting Up MariaDB
728(1)
Configuring a Hostname
729(2)
Wrapping It Up
731(1)
Summary
732(1)
Chapter 21 Continuous Integration
733(32)
What Is Continuous Integration?
733(30)
Preparing a Project for CI
735(14)
Installing Jenkins Plug-ins
749(1)
Setting Up the Git Public Key
750(1)
Installing a Project
751(5)
Running the First Build
756(1)
Configuring the Reports
757(3)
Triggering Builds
760(3)
Summary
763(2)
Chapter 22 Objects, Patterns, Practice
765(16)
Objects
765(4)
Choice
766(1)
Encapsulation and Delegation
766(1)
Decoupling
767(1)
Reusability
768(1)
Aesthetics
768(1)
Patterns
769(4)
What Patterns Buy Us
770(1)
Patterns and Principles of Design
771(2)
Practice
773(5)
Testing
774(1)
Standards
774(1)
Version Control
775(1)
Automated Build
775(1)
Continuous Integration
776(1)
What I Missed
776(2)
Summary
778(3)
Appendix A: Bibliography 781(4)
Books
781(1)
Articles
782(1)
Sites
782(3)
Appendix B: A Simple Parser 785(32)
The Scanner
785(12)
The Parser
797(20)
Index 817
Matt Zandstra has worked as a web programmer, consultant, and writer for over two decades. He is the author of SAMS Teach Yourself PHP in 24 Hours (three editions) and is a contributor to DHTML Unleashed. He has written articles for Linux Magazine, Zend, IBM DeveloperWorks, and php|architect Magazine, among others. Matt was a senior developer/tech lead at Yahoo and API tech lead at LoveCrafts. 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.