
Download source files here
Install the local PHP server stack (Wamp) on Windows by downloading and installing Apache, MySQL, and PHP, plus the Visual C++ redistributable, then start the server and test with localhost.
What will you learn in this section
Define a PHP class with the class keyword, name the class, and enclose it in curly braces. Use comments to describe the class for future programmers.
Learn PHP object oriented programming fundamentals by defining a class, declaring attributes, and creating class methods using the function keyword, including operation1 and operation2, with simple descriptive notes.
Access class constants in PHP by using the class name and double colon, echoing values to display car models; learn constants cannot be reassigned.
Review the core object oriented programming concepts in PHP, including building a class construct, adding class attributes, declaring class methods, and using class constants for maintainable, data-driven structures.
Define a php class with default first name and last name attributes and a class constant, then display them. Reassign the names using a method and show the updated values.
What will you learn in this section
Create a person class with attributes for first name, last name, age, and a constant middle name, then define methods and instantiate an object using the new keyword.
Understand how to obtain class attributes by declaring a PHP class person with first_name, last_name, and age, plus a middle_name constant, then create an object with new and echo attributes.
Learn to display object attributes in PHP using echo and the object accessor to retrieve first name, last name, and age from a Person class, with values like Jaylene Forté.
Learn to change PHP class attribute values by defining a Person class with first name, last name, age, and constants, create an object, and access attributes with the arrow operator.
Print and modify object attributes in a PHP class, updating first name, last name, and age. Show that constants like middle name and hair color cannot be reassigned.
Learn PHP object oriented techniques by creating private attributes, a public constructor, and get and set methods to assign and retrieve a first and last name, then display full name.
Define global constants with the define function and use all caps to set values that cannot be changed across the PHP script, illustrated by first name, last name, and age.
Learn how to use php global constants to display values with echo, including first name, last name, and age constants, and why reassigning them triggers a syntax error.
Review PHP object oriented programming concepts from section 3, including creating objects, accessing and changing attributes, adding and destroying attributes, and using getters, setters, methods, and global constants.
Define a PHP Person class with private first and last names, a constructor, and public set and get methods. Create a Person, display original name, then update to Joe Smith.
What will you learn in this section
Explore how PHP class constructors initialize object attributes when new objects are created, using the __construct method to assign first and last names with $this and the arrow operator.
Explore how the destructor runs for each php o o p object, printing attributes like first and last names before the object is destroyed.
Explore how the private access modifier restricts visibility to within the same class, declare private properties, and see why external access triggers an error.
Explore building a PHP object oriented employee system with a private Employee class, constructor, destructor, and get/set methods, creating objects from user data and displaying their info.
What will you learn in this section
Review section 5 recaps class constants, static attributes, and static methods, operating on the class. Assign constants once and access them from the class, while static attributes can be reassigned.
Watch a live demo of a PHP OOP project showcasing static class attributes, class constants, and methods, with default values, value updates, and constants display via the class.
Explore PHP object oriented programming by building a people class with static attributes, a class constant, and static methods to set and display names using self and the double colon.
What will you learn in this section
Explore class inheritance in PHP by creating a person class with private attributes and public getters and setters, then extend it to a child class to reuse code via extends.
Examine how the private access modifier affects inheritance in PHP OOP, showing that private attributes and methods are not inherited or accessible by child classes.
Explore the protected access modifier in PHP OOP, showing how it can be inherited by child classes but not accessed from outside, with examples of protected properties and methods.
Master overriding public class attributes in PHP object oriented programming by extending a parent class, redefining attributes, and updating values with a simple set values method.
Explore the final keyword in PHP OOP, learning how final prevents inheritance for classes, attributes, and methods, and see how it triggers errors when inheritance is attempted.
See how a child class overrides a parent method to customize behavior. Use the final keyword to prevent overriding and learn that private methods cannot be inherited.
Explore inheritance in PHP to reuse code and manage object attributes across classes. Understand how public, private, and protected visibility control access, attribute overriding, and final prevents inheritance.
Explore class inheritance in php by using a parent class a and a child class b, displaying a’s attributes via methods and understanding public, protected, and private access.
Explore a PHP OOP exercise that defines class A with protected attributes, extends it with class B, and uses get attributes and parent method calls to display values.
Watch a final project live demo building an employee database of objects, displaying each employee’s attributes and calculating weekly pay from hours worked and hourly rate.
Build a PHP employee class with constants, attributes, and a public constructor. Compute pre-tax pay from hours worked and pay rate, and display results.
Master object oriented programming foundations with classes and objects to design and maintain modern PHP projects. This course conclusion highlights OOP and free resources like php.org and php.net.
PHP Object Oriented Programming is now the gold standard expected by a large number of companies (and especially among e-commerce websites). The problem? There are never enough programmers out there who really, really know what they’re doing with PHP OOP. By getting to grips with it, you can not only build better websites; you can reduce the many hours of coding normally needed to create them too. This online course will show you how.
Build high performance, dynamic web pages with PHP OOP
Maintain PHP code more efficiently in web projects
This PHP Object Oriented Programming course contains over 63 lectures and 5 hours of content; that’s more than enough to set you on the path to becoming a PHP OOP expert. Although not designed for complete beginners, anyone with some basic HTML development experience will be more than capable of following along.
The course begins with installation of the local PHP server, then it’s straight into the essential constructs of PHP (i.e. class constructs, attributes, methods and constants). Section 3 covers the the PHP Object in depth, from how to create an object to obtaining and changing its attributes. From then on things get more advanced with an extensive look at the Constructor/ Destructor Magic Method, then static class attributes, constants and methods.
With each section you will complete a practical exercise to put your knowledge to the test and gain hands-on experience of the material you’ve just covered. By the time you’re done, you’ll know the basics of PHP OOP inside out, and plenty more besides.
About PHP OOP
PHP is a widely used programming language that’s especially suitable for web development and e-commerce. Object Oriented Programming is a programming model often used with PHP. With OOP, programmers define not just the data type of a data structure, but the functions that can be applied to it too.