

OOP with PHP

Learn PHP the easy way with over 5 hours of videos

Object Orientation in PHP – Subscription Access

Object Oriented Programming in PHP

PHP is the backbone of the world's most popular sites and whether you realize it or not, it might be the scripting language behind your own site. If you run a blog-based site, like WordPress, that's probably the case. So if you've thought "hey, maybe I should actually know some of this mystical magical backend language", this course is for you. And while this series teaches plenty of PHP syntax, what you will find most valuable is a spoon-fed introduction to object oriented thinking.

To truly learn how to program in an object oriented manner, you must first understand the concepts and ideologies behind OOP, not just the syntax of PHP. Of course,  This course includes lectures that break down subjects like abstraction, polymorphism, inheritance and encapsulation in a simplified manner for anyone to understand - whether you are a beginner to PHP or just barely know enough to carefully edit some of your WordPress plugins, we think you'll love getting a deeper understanding of both PHP and OOP.

Lawrence Turton

Learn more about your instructor...

This lesson is taught by Lawrence Turton, CartoonSmart's resident HTML5-guru. Lawrence is an experienced programmer with HTML5, CSS3, jQuery, PhoneGap, and Dreamweaver. Lawrence has taught over 70 hours for CartoonSmart.  For freelance inquiries, Lawrence can be found at

What is PHP...


Course Outline


Welcome to a course that will teach you about object oriented analysis, design and programming. This video series isn't just about learning PHP syntax, it will teach you the why's and how's behind plenty of commonly used terminologies and phrases used in OOP.

Defining object orientation and objects

Defining an object can be tricky, so we need to know the very definition of an object. How do you define an object and then translate that into the programming world.

What is a class?

A class is used to build an object in programming. But why would you want to use classes? Why do they exist and have purpose in programming? Well, we're about to find out.


Abstraction is the necessary process of simplifying our program. It is a principle that is carried all throughout programming and not just object oriented programming. Octopus


Polymorphism may sound like a big word but all it really means is 'many forms'. For example if you use the plus '+' symbol you can add two numbers together and likewise using the same plus operator two strings will be concatenated together.


Inheritance is a form of instantiating a sub class with that class then pulling in all the parents' properties and methods. Inheritance has a lot to do with abstraction.


Encapsulation is grouping properties and methods together in an object. It is essentially the container that keeps everything together. However this is not the only one purpose of encapsulation. It also involves black boxing which is hiding certain properties and methods to further ensure our application works the way it should.

Object Oriented Analysis

Object oriented analysis is very important when starting a new project. Missing this stage will be disastrous for large scale projects and even small ones if not done properly. Once the data analysis has been done we can then move onto the next step which is designing the program.

What is UML

The universal modelling language is very important for diagramming the class structure of a program. This lecture will give you a brief overview as you've already seen some UML in prior lectures.

UML relationships, aggregation and composition

UML is simple but allows for complex modelling. However don't go too far with UML lest it become burdensome, instead of a tool to help produce a good program structure. Mainly your UML will be simple, with standard inheritance relationships. However you can also show aggregation and composition relationships as well with UML. These are the essentials and should cover all the UML you typically need to know.

Sequence Diagrams

Sequence diagrams aid in explaining to you (the programmer) or your client, how the user will interact with your program. If you or your client is unsure about how a certain scenario will play out, then you will need to demonstrate it with this useful digram making it as detailed as possible.

Public, private & protected

Classes are made up of many members. A member being either a property or method. However for each member we can set the access level, ensuring a more robust application structure.

Overriding Members

Overriding has to do with the way in which your members work within inheritance. For example, a sub class can have a member that will override or overwrite the parent member with the same name. This can be very useful for abstraction and makes our application more flexible when creating objects.

Static / Shared / Class level members

Shared, class level or what's more commonly known as a static member are shared across all instances (objects) of that class. A static member can also be accessed in memory without even creating a single instance (object) from that class.

 Concrete & abstract classes

To put it simply a concrete class can be instantiated, which means we can create an object from that class. An abstract class is a class that we cannot create an object directly from. An abstract class is there purely for inheritance.


Interfaces are a lot like contracts for our application. It ensures that classes that implement a certain interface will have the methods required, thus committing it to specific functionality.


Traits are important in single inheritance languages. Most of the time there is no need for multiple inheritances, however in programming languages like PHP that only support single inheritance; traits can be useful to solve the problem of code reuse.

Beginning a Bank Account Project - UML diagram

For the rest of the series, we will get a bit more hands-on with a hypothetical bank account project, starting at the design phase, with a UML diagram.

Creating the abstract class

For code reuse and dependency of sub classes, we will focus on the abstract class and create it first.

Creating sub classes part 1

Once we have created the abstract class, we can now create the sub classes. We will also create interfaces for the penalty method to be called on certain accounts.

Creating sub classes part 2

Next we want to finish off creating our concrete classes. We need to polish off explaining the withdraw method and then complete the concrete classes.

Trait & interface

Now lets add a trait, then use it with the bank account (for both the debit and savings accounts). This'll allow us to create a more robust application.

Instantiating classes and running the program

Now that we have our classes we can call the sub classes. This will then create instances of the sub classes and allow us to perform actions on those instances or objects.

Running the program further

Next we'll take a look at running our program even further to find out more about instantiating classes and producing instances of a class (objects) at runtime. Also we'll review the process of checking for a certain interfaces which guarantees specific methods are able to be run on our objects.

Using interfaces at runtime

Using interfaces at runtime is very important as it will allow us to check that an object has the correct methods (we don't want to call a non-existent method on an object). This way we use interfaces for class integrity and avoid runtime errors.

Class constructors

When instantiating classes sometimes we need special property values each time we instantiate a new object. We can do this via a constructor function. Scroll

Inherited class constructors

In this lecture we'll add a constructor function to our abstract bank account class. Then we will link up the parent constructor to the sub class constructor.

Static properties, methods and constants

In this video, we'll play with some examples of static properties and methods in PHP. We will also discuss constants which are compiled in memory, like static properties, however they are not variable. Constant can only be set once and cannot change through the lifetime of the program.


A special thanks for watching this lecture.

Preview some of the course below...

Over 5 Hours of Comprehensive PHP Training

OOP PHP Box Video Tutorials

Two affordable purchasing options...

Purchase Option 1 - Lifetime Access

Already have Lifetime Access? You can get started watching the course from right here.

Purchase Option 2 - Subscribe to Every CartoonSmart Course!

  • Billed monthly until cancelled

  • Billed once per year, 2 times

Buy Now



Uh oh, missing your affiliate ID. Create one real quick