1h 57m – Intermediate
Whether you’re enhancing or optimizing existing code or just starting from scratch, there’s never a better time to start integrating object-oriented design techniques. This course shows how to integrate the principles of object-oriented programming into the build of a PHP-driven web page or application. After an overview of what objects and classes are and why they should be used, author Jon Peck dives into creating and instantiating objects, then defining the class relationships and interactions that will form the basis of your coding arsenal. The course also shows how to leverage PHP objects and implement design patterns, and looks at steps you can take to continue adding to your programming tool belt.
Topics include:
Historical overview of object-oriented PHP
Defining classes
Creating a method/object context with $this
Accessing classes without instantiation
Creating a database class
Extending and abstracting classes
Cloning and comparing objects
Error handling with exceptions
Implementing design patterns, such as the factory and strategy patterns
Introduction – 4m 10s
Welcome – 39s
Exercise files – 2m 16s
What you should know – 1m 15s
1. Introduction to Object-Oriented Programming – 7m 47s
What is an object? – 2m 6s
What is a class? – 2m 7s
Why should you use object-oriented programming? – 2m 14s
The history of object-oriented PHP – 1m 20s
2. Creating Your First Object – 16m 40s
Defining a class – 2m 58s
Defining class properties – 3m 26s
Creating a method and exploring object context with $this – 2m 50s
Instantiating an object and accessing its contents – 3m 19s
Specifying the visibility scope – 4m 7s
3. Overloading with Magic Methods – 15m 51s
What is a magic method, and do I need one? – 2m 23s
Overloading property access – 6m 37s
Customizing object construction – 4m 34s
Standardizing object rendering as a string – 2m 17s
4. Accessing Classes without Instantiation – 20m 54s
Using the static keyword – 3m 36s
Leveraging scope resolution operators – 1m 10s
Setting constant values – 2m 47s
Implementing static methods – 5m 43s
Creating a database class – 7m 38s
5. Class Relationships and Interactions – 26m 19s
Extending your class – 6m 8s
Abstracting classes – 5m 57s
Sharing interfaces using polymorphism – 4m 39s
Overriding methods, properties, and constants – 3m 25s
Cloning and comparing objects – 2m 51s
Referencing objects – 3m 19s
6. Built-In PHP Objects – 14m 52s
Leveraging standard class objects – 2m 42s
Retrieving objects from the database – 5m 41s
Error handling with exceptions – 2m 6s
Customizing PHP exceptions – 4m 23s
7. Design Patterns – 8m 2s
Identifying the singleton pattern – 1m 42s
Using the factory method pattern – 1m 51s
Implementing a strategy pattern – 4m 29s
Conclusion – 2m 57s
Looking forward to namespaces – 47s
Next steps – 1m 6s
Goodbye – 1m 4s