PHP: Object-Oriented Programming
3h 54mIntermediate2017-11-17
Authors

Kevin Skoglund
Founder of NovaFabrica
Course details
PHP developers can benefit from the efficient, well-organized, reusable, and easy-to-understand code that object-oriented programming offers. In this intermediate-level course, Kevin Skoglund introduces object-oriented programming (OOP) principles for PHP. Kevin shows how to define a class, add properties and methods, and create new instances. He demonstrates how to use class inheritance to share, extend, and override class behavior, and how to control access to the properties and methods of a class. He explains the difference between static and late static bindings, and shows how to customize the PHP "magic" methods, which are triggered automatically. In the final chapter, he shows how to add object-oriented code to a real-world PHP website, so you can see OOP techniques in action.
Learning objectives
Defining classes
Calling methods
Class inheritance
Extending and overriding classes
Accessing and controlling access to properties and methods
Static properties and methods
Magic methods: constructor, destructor, and clone
Creating a PHP OOP project
Learning objectives
Defining classes
Calling methods
Class inheritance
Extending and overriding classes
Accessing and controlling access to properties and methods
Static properties and methods
Magic methods: constructor, destructor, and clone
Creating a PHP OOP project
Skills covered
PHPProgramming LanguagesOpen SourceSoftware DevelopmentDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - PHP - OOP techniques
- 02 - How to use the exercise files
1. Overview and Project Set Up
- 03 - What is OOP
- 04 - Project set up
2. Object Basics
- 05 - Define a class
- 06 - Instances
- 07 - Class properties
- 08 - Class methods
- 09 - Refer to an instance
- 10 - Challenge - Properties and methods
- 11 - Solution - Properties and methods
3. Class Inheritance
- 12 - What is inheritance
- 13 - Define a subclass
- 14 - Extend and override
- 15 - Challenge - Inheritance
- 16 - Solution - Inheritance
4. Object Access Control
- 17 - Visibility modifiers
- 18 - Beware of overloading
- 19 - Setter and getter methods
- 20 - Challenge - Access control
- 21 - Solution - Access control
5. Static Properties and Methods
- 22 - The static modifier
- 23 - Inherited static behaviors
- 24 - Class constants
- 25 - Refer to the parent class
- 26 - Late static bindings
- 27 - Challenge - Static references
- 28 - Solution - Static references
6. Magic Methods
- 29 - Constructor method
- 30 - Constructor arguments
- 31 - Destructor method
- 32 - Clone method
- 33 - Assignment by reference
- 34 - Compare objects
- 35 - Autoload undefined classes
7. A PHP OOP Project
- 36 - Project introduction
- 37 - Challenge - The bicycle class
- 38 - Solution - The bicycle class
- 39 - From instances to HTML
- 40 - Read from a CSV file
- 41 - Improve ParseCSV
- 42 - From a CSV file to instances
Conclusion
- 43 - Happy Coding
Related courses
- PHP: Object-Oriented Programming with Databases
- Learning PHP: Building Dynamic Websites from Core Concepts to Applications
- Object-Oriented Programming and WordPress
- Advanced PHP
- PHP Techniques: Pagination
- Practice It: PHP Classes and Objects
- PHP: Accessing Databases with PDO and MySQLi
- PHP: Email with Swift Mailer