Object-Oriented PHP Basics Course

Go to class
Write Review

Free Online Course: Object-Oriented PHP Basics Course provided by Treehouse is a comprehensive online course, which lasts for 3-4 hours worth of material. The course is taught in English and is free of charge.

Overview
  • At a glance, object-oriented programming can appear to be far more complex than simple procedural, or inline, code. However, this doesn’t have to be the case. Because object-oriented programing is similar to the way human beings perceive the real world, using the object-oriented approach, can help you visualize the solution to a problem more easily.

    Object-oriented programming, or OOP for short, is a style of coding that allows developers to group similar tasks into containers. In PHP, containers are defined using classes. A class contains all the functions and variables that describe an object.

    What you'll learn

    • Terms: class, object, instance, property, method
    • Why and when to use OOP
    • Static Methods
    • Magic Methods and Constants
    • Filtering

Syllabus
  • Why Object-Oriented Programming?

    Object-oriented programming, or OOP for short, is a style of coding that allows developers to group similar tasks into containers. In PHP, containers are defined using classes. A class contains all the functions and variables that describe an object.

    Chevron 5 steps
    • Introducing the Cookbook Project

      3:27

    • What is Object-Oriented Programming?

      3:20

    • What is OOP?

      5 questions

    • Why Use Object-Oriented Programming?

      6:02

    • Why Use OOP?

      3 questions

    Understanding Classes

    Object-oriented programming lets us group data as well as functions into a specific topic or piece of functionality. In PHP we call these groupings classes. We'll explore the ways a class allows us to store and retrieve data, as well as to perform actions, or functions, on that data.

    Chevron 9 steps
    • Classes and Objects

      3:44

    • Classes and Objects

      2 objectives

    • Adding Properties

      2:56

    • Accessing Properties

      3:14

    • Properties of a Class

      2 objectives

    • Adding Methods

      2:18

    • Accessing Methods

      1:57

    • Methods of a Class

      1 objective

    • Object-Oriented Concepts

      7 questions

    Building the Recipe

    To build our recipe class we'll learn to use access modifiers with getters and setters to control access to properties and methods. We'll also see the single responsibility principle in action and create static methods for multiple display options.

    If that's not enough, we'll also become a magician!

    Chevron 16 steps
    • Access Modifiers

      6:04

    • Access

      3 questions

    • Associative Arrays

      7:36

    • Cleaning Up the Class

      2:58

    • Accessing Arrays

      5 objectives

    • Adding Getters and Setters

      8:32

    • Ready Get Set Go

      5 questions

    • Static Methods

      4:52

    • Recipe Details

      3:16

    • Separating Methods

      2:43

    • Static

      4 objectives

    • Magic Methods

      5:05

    • Magic Constants

      6:14

    • All About the Magic

      5 questions

    • Populating the Recipes

      3:15

    • Controlling the Class

      3 objectives

    Building a Collection

    Building a collection object allows us to group multiple objects together while adding functionality. We'll be creating our cookbook which will allow us to list recipes, filter recipes and create a shopping list of ingredients.

    Chevron 10 steps
    • Creating a Collection

      5:55

    • Enhancing the Collection

      3:30

    • Filtering

      3:06

    • Collections

      5 questions

    • Shopping List Method

      8:52

    • Lists

      5 questions

    • Creating a Meal Plan

      6:57

    • Collection Objects

      3 objectives

    • Conclusion

      1:33

    • Final Quiz

      10 questions