
Explore PHP object oriented programming through a 100% practical approach, covering classes, objects, public, protected, static, and private modifiers, getters and setters, constructors, abstract classes, interfaces, traits, and magic methods.
Learn to create a PHP class by using the class keyword, naming it test, and defining properties and methods inside curly brackets, starting from the root file index.
Learn how to instantiate your first object in PHP by creating an object from a class using the new keyword, inspecting its type with var_dump, and confirming the object type.
Learn about PHP object oriented basics by defining properties and methods within a class, accessing them with the arrow operator, and troubleshooting a syntax error when referencing a property.
Learn how to access class properties and methods in PHP object-oriented programming, using public access, with an introduction to protected and static modifiers, and calling methods with parentheses.
Learn how to access a class's own properties from inside the class using $this->property and the dot operator to append its value to a return string.
Access a class's own methods from inside the class by invoking them as functions with parentheses, returning strings and concatenating with the object's properties to produce output.
Learn about protected properties: a protected property cannot be accessed directly from an object; access it only through class methods, as shown by errors and internal access in methods.
Learn how protected properties differ from public ones in PHP object oriented programming and implement setter and getter methods to control value changes.
Learn to implement getters and setters to access and modify a protected property via public methods in PHP object-oriented programming, defining get property and set property methods on an object.
Demonstrate updating a protected property with a setter and retrieving it with a getter. Create the object, use the setter to assign a value, then use the getter to confirm.
Learn dynamic getters and setters in PHP object oriented programming by using a name parameter to access and set multiple class properties.
Practice using getters and setters in PHP object oriented design, and learn how the magic method __get handles missing properties by executing custom code instead of errors.
explain the php magic __set method, its two-parameter signature (property name and value), and how it runs when assigning to non-existent properties, illustrating setter and getter behavior.
Understand how the __construct magic method initializes object properties in PHP, demonstrates passing parameters during object instantiation, and handles constructor arguments with real-world examples.
A constructor sets up the values of the properties when creating a new object, either directly or by invoking class methods to initialize properties.
Learn what a static property is by declaring it inside a class, naming it 'static', and recognizing its static nature.
Static properties belong to the class, not to objects, and you access them from the class using the class name and the double colon; the example shows a zero-initialized property.
Learn to access and increment a static property inside a class using self::, a zero-initialized class-level counter that increases with each new object.
Explore static methods and static properties in PHP, using self:: to access static members inside methods. See how a static property counts objects and affects the result.
Learn how static methods call other static methods and access static properties, returning computed results, while understanding how public and protected methods behave when invoked from within the class.
Explore how PHP's __call magic method intercepts calls to undefined methods, preventing fatal errors by handling the method name and its arguments array inside the class.
Learn how to define PHP's __toString magic method to convert an object to a string for echo or print, returning a string to avoid fatal errors.
Initialize objects efficiently by using the constructor as a powerful magic method to set property values, handle defaults, and even invoke internal methods upon creation.
Describe how the destruct magic method in PHP is the opposite of construct, invoked automatically when an object is destroyed, and how destructors can echo messages or perform cleanup.
Learn how the instanceof operator checks if an object is an instance of a class, returning a boolean that drives if statements and echo outputs in PHP.
Learn to use get_declared_classes() to retrieve all declared PHP classes, outside a class context, inspect the list with var_dump and foreach, and locate a specific class.
Learn how PHP's class_exists checks for a class, returns a boolean, and drives conditional logic; view implicit boolean-to-string conversions and the role of the __toString method in echo.
Explore built-in PHP functions property_exists and method_exists to check an object's property or method. Pass the object and the name to return true or false and drive conditional logic.
Learn how PHP's get_class_vars and get_class_methods inspect a class by returning arrays of its public properties and methods, with hands-on examples showing visibility effects.
Learn from zero the meaning and use of:
- Classes
- Interfaces
- Traits
Beside the general purpose concepts, dive deep in concepts like:
- Inheritance
- Polymorphism
- Accessors (public, private, static)
- Constructors
- Overwrite
- Predefined functions
- Magic methods,
- Nested classes
- Abstract classes
...and many other concepts. Then, create a login class as way to sum up the concepts.
Project:
As a way to say "thank you for following the course" I added a project that can be described as follows.
Develop new skills in a practical manner, by doing a project together with me, using a in-demand database like Mongo. Actually, knowing both SQL (Relational Databases - MySQL, Sql Server, etc ) and No-SQL(Mongo, Redis, etc) is essential for every developer.
Learn working with Mongo Database, Compass visualizer of Mongo Database and PHP by building an OOP website starting from scratch and continuing up to a finished e-commerce website.
We will add functionalities like : Shopping Cart, CMS (Content Management System), Ajax Calls, Insert JPEG's into Database, Login Logic Database Calls, Database Connections, etc.
This course is mainly oriented on back-end side of things and less focused on looks and design that you can configure your own way.
I choose always the less complicated way of dealing with code when solving some issues because firstly this is a learning course and secondly, if you understand the basics of solving in one way, you'll be able to find better solutions as well. But always, basics first!
Even if is all about PHP OOP and Mongo DB, I am explaining every line of Javascript code as well. I don't like leaving things unexplained.