An open API service indexing awesome lists of open source software.

https://github.com/davidobinna/beginners-object-oriented-programming-php

Learn how to use PHP OOP from scratch
https://github.com/davidobinna/beginners-object-oriented-programming-php

Last synced: about 1 year ago
JSON representation

Learn how to use PHP OOP from scratch

Awesome Lists containing this project

README

          

#PHP - OOP Document
_PHP introduced object-oriented programming features since version 5.0. Object-Oriented programming is one of the most popular programming paradigms based on the concept of objects and classes.
#Section 1. Objects & Classes
Objects & Classes – learn the basic concepts of OOP including objects and classes.
The $this keyword – help you understand PHP $this keyword and how to use it effectively.
Access Modifiers: public vs. private – explain to you the access modifiers in PHP and help you understand the differences between the private and public access modifiers.

#Section 2. Constructor and Destructor
Constructor – explain to you the constructor concept and how to use it to initialize attributes.
Destructor – learn how to use destructor to clean resources when the object is deleted.

#Section 3. Properties
Typed Properties – show you how to add type hints to class properties.
Readonly Properties – use the readonly keyword to define readonly properties that can be initialized once within the class.

#Section 4. Inheritance
Inheritance – how to extend a class for code reuse.
Call the parent constructor – show you how to call the parent constructor from a child class’s constructor.
Overriding method – guide you on how to override a parent class’s method in the child class.
Protected Access Modifier – explain the protected access modifier and how to use protected properties and methods effectively.

#Section 5. Abstract classes
Abstract Class – guide you on abstract classes and how to use them effectively.

#Section 6. Interfaces
Interface – explain to you the interface concept and how to create interfaces.

#Section 7. Polymorphism
Polymorphism – explain the polymorphism concept and show you how to implement polymorphism in PHP using abstract classes or interfaces.

#Section 8. Traits
iTraits – introduce you to traits.

#Section 9. Static methods & properties
Static Methods and Properties – show you how to use static methods and properties.
Class constants – learn how to define class constants using the const keyword.
Late Static Binding – introduce the late static binding concept and how to use it effectively._

#Section 10. Magic Methods
Magic methods – understand how the magic methods work in PHP. __toString() – return the string representation of an object.
__call() – show you how to use the __call() magic method.
__callStatic() – show you how to use the __calStatic() magic method.
__invoke() – learn how to define a function object or function by implementing the __invoke() magic method.

#Section 11. Working with Objects
Serialize Objects– use the serialize() function to serialize an object into a binary string and how to use the __serialize() and __sleep() magic methods
Unserialize Objects – guide you on how to use the unserialize() function to convert a serialized string into an object. Also, discuss the __wakeup() and __unserialize() magic methods.
Cloning Objects – show you how to copy an object.
Comparing Objects – how to compare two objects.
Anonymous class – learn how to define a class without a declared name.

#Section 12. Namespaces
Namespace – learn how to use namespaces to group the related classes.

#Section 13. Autoloading
Autoloading Class files – learn how to load classes automatically.
Autoloading using Composer – show you how to use Composer to autoload classes.

#Section 14. Exception Handling
try…catch – show you how to use the try…catch statement to handle exceptions that may occur in your script.
try…catch…finally – learn how to clean up the resources when an error occurs using the finally block.
Throw an exception – guide you on how to throw an exception using the throw statement.
Set an Exception Handler – show you how to use the set_exception_handler function to set a global exception handler to catch the uncaught exceptions.

#Section 15. Class / Object Functions
class_exists – return true if a class exists
method_exists – return true if an object or a class has a specific method.
property_exists – return true if an object or a class has a specific property.