
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.
Explore class attributes in php oop fundamentals by declaring class properties with var, setting default values, and using examples like first name, last name, and age.
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.
Compare global constants and class constants, then declare class constants inside a class using the const keyword, assign a one-time value, and prevent reassignment.
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.
Explore a step-by-step PHP object-oriented exercise building a Person class with a class constant, first and last name attributes, and set/get methods, including creating objects and echoing properties.
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 obtain attributes from PHP objects using the arrow operator, accessing first name, last name, and age without using the dollar sign.
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 how to create new attributes on PHP objects after instantiation, adding properties such as first name, last name, and age, and display them using the object operator.
Learn to destroy object properties in PHP by using private attributes and the unset function to remove first name and last name, then observe undefined property errors.
Explore PHP object-oriented basics by defining a class with public and private attributes, a constructor, and object methods, then create and call methods using the arrow operator.
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.
Show the exercise live demo results by displaying default first and last name attributes, reassigning new values with methods, and displaying the global PDP program constant in PHP OOP.
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 PHP object oriented programming uses a two-parameter constructor to assign first and last name attributes with the this keyword, and how objects are created and displayed.
Learn to build unique PHP objects by defining a class constructor, assigning first name, last name, and age with this, creating diverse objects, and displaying them with echo.
Learn to build unique objects in php using a constructor by passing first name, last name, and age, and see the objects display on a local server.
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 access modifiers in PHP, focusing on public visibility for attributes and methods, and learn to instantiate objects, use constructors, this, and arrow accessors to display data.
Explore how the private access modifier restricts visibility to within the same class, declare private properties, and see why external access triggers an error.
Learn how to access and modify private class attributes in PHP using the this keyword and the arrow operator, with constructors and get/set methods to manage values.
Explore constructors and magic methods in PHP object oriented programming fundamentals, learn how constructors initialize data, create unique objects, manage memory with destructors, and enforce private attributes with access modifiers.
Demonstrates a live php oop exercise: instantiate three employee objects with a constructor using user-provided names and IDs, display attributes with methods, and explain magic methods including destructor.
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
Explore PHP object oriented programming by defining and using class constants with the const keyword, accessed via the class name using ::, and understand that their values cannot be changed.
Explore class static attributes in PHP OOP by declaring public static properties on a Person class, accessing them with the class name, and updating values to demonstrate dynamic changes.
Explore PHP object-oriented programming with class static methods, learn how to declare with static, call via the class name using ::, and use static functions without instantiating objects.
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.
Explore how a parent class provides attributes and methods, and how a child class inherits them in php, using set and get methods for first name and last name.
Explore how the public access modifier interacts with inheritance in PHP OOP, demonstrating why encapsulation requires private attributes and how public data can be exploited.
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.
Demonstrates inheritance and overriding in PHP OOP by showing how class B overrides inherited attributes from class A and uses get/set value methods with this to update and display them.
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.