Back Button Languages
Object-Oriented Principles in PHP

Object-Oriented Principles in PHP

The typical beginner, whether they realize it or not, first learns procedural programming. But, before too long, they level up. Suddenly, an entirely different paradigm is introduced: object-oriented programming. Little do they know that they'll spend years researching and learning exactly what it means to work with objects and messages.

In this series, you'll be introduced to the core principles of object-oriented programming in PHP. We'll begin with the basic constructs and work our way up.

Intermediate
9 episodes
1h 33m
9
Latest Episode in This Series

Added 5 months ago

Exceptions

Any time your code encounters an unexpected condition that it can't handle, an exception should be thrown....

Watch
Object-Oriented Principles in PHP

Object-Oriented Principles in PHP

The typical beginner, whether they realize it or not, first learns procedural programming. But, before too long, they level up. Suddenly, an entirely different paradigm is introduced: object-oriented programming. Little do they know that they'll spend years researching and learning exactly what it means to work with objects and messages.

In this series, you'll be introduced to the core principles of object-oriented programming in PHP. We'll begin with the basic constructs and work our way up.

Begin
9
Latest Episode in This Series

Added 5 months ago

Exceptions

Any time your code encounters an unexpected condition that it can't handle, an exception should be thrown....
Watch

Your Teacher | Jeffrey Way

https://laracasts.s3.amazonaws.com/avatars/jeffrey-avatar.jpg's avatar
Hi, I'm Jeffrey. I'm the creator of Laracasts and spend most of my days building the site and thinking of new ways to teach confusing concepts. I live in Orlando, Florida with my wife and two kids.
  1. Section 1 Constructs

    1. EPISODE 1

      Run Time 4:42

      Let's begin with an introduction to classes in PHP. I like to think of a class as a blueprint or template that defines the overall structure and behavior for some concept in your codebase.

    2. EPISODE 2

      Run Time 9:24

      If a class is the blueprint, then an object is an instance (or implementation) of that blueprint. In this lesson, you'll learn how to create multiple instances of a class, how to define and set internal state, and how to declare static constructors that better reflect how you might speak in real life.

    3. EPISODE 3

      Run Time 10:47

      Free

      Inheritance allows one class to inherit the traits and behavior of another class. This should instantly make sense, in the same way that a child inherits characteristics from their parents. In this lesson, we'll review several examples of inheritance in action.

    4. EPISODE 4

      Run Time 8:00

      Free

      An abstract class provides a template - or base - for any subclasses. In this lesson, we'll work through an example that demonstrates how, why, and when you might reach for an abstract class.

    5. EPISODE 5

      Run Time 8:29

      Think of an interface as a class with no behavior. Instead, it describes the terms for a particular contract. Any class that signs this contract must adhere to those terms. Let's review this idea using the example of a newsletter signup.

    6. EPISODE 6

      Run Time 12:28

      Encapsulation allows a class to provide signals to the outside world that certain internals are private and shouldn't be accessed. So at it's core, encapsulation is about communication.

    7. Let's move on to object composition. To break it down into the simplest of terms, composition is when one object holds a pointer to another object. This allows us to construct complex functionality by combining various types.

    8. EPISODE 8

      Run Time 13:40

      A value object is an object whose equality is determined by its data (or value) rather than any particular identity. To illustrate this, imagine three five dollar bills resting on a table. Does one bill have a unique identity compared to the other two? From our perspective, no. Five dollars is five dollars regardless of which bill you choose. However, compare this with two human beings who have the same first and last name. Are they identical, or does each person have a unique identity? Of course in this case, the latter is the correct answer.

    9. EPISODE 9

      Run Time 16:56

      Any time your code encounters an unexpected condition that it can't handle, an exception should be thrown. In this lesson, we'll review the "why, how, and when" of exceptions, as well as some interesting ways to improve readability through naming and static constructors.

Series still in development robot

*Series still in development. Check back often for updates.