check out this: https://laracasts.com/series/object-oriented-bootcamp-in-php
the first lesson is called classes, has to be on point with what your asking.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
It's been a few months since I've finished the Team Treehouse PhP course. I've recently been learning Javascript to open up full stack opportunities and I have been Taking Jeffreys Laravel from scratch course. I've found my self a little hazy as to what exactly a class is again and what a object is to that class, correct me if I am wrong.
So a class holds a series of properties. Lets say we have a class named "Person". Inside the class we can add first name, last name, birthday, gender, and location. An object is just a placeholder for that class.
What you can do is use a database, such as MySQL & what have you, and fill in that objects properties by having a user fill in a database via a forum.
I feel that the two things I need to touch base on is classes & objects, and how they fall into play with name spacing, type hinting and how one can use tinkers database capabilities right inside your php code, in your Laravel project.
Note: Please don't say something worthless like "go google it", or "check the docs" or just go watch all 25 hours of footage over again. I just need to touch base on thee above topics.
Seth
Hey Seth,
I will strongly second the series @jbowman99 recommended, and in fact I'd say you should watch it through completely before you worry about any of the others.
In the simplest terms.. A class is the definition of a thing, and operations it can perform. An object is an instance of that class.
So, in real physical world terms, you could think about a class that defines an animal. What properties does an animal have, and what kinds of things can it do? The class is .. essentially the rules for what makes an animal an animal, and not a chair. The animal itself is the 'object'.
That's a little abstract, so trying to be a bit more on the nose, think about dogs. We could write a class that defines the characteristics of a dog:
A dog might have the following properties:
A dog also would have some basic functions that it performs (class methods):
Now, of course there are lots of different kinds of dog, different breeds, etc.. but if you have two dogs in front of you, physically, they would represent two separate instances of the dog class. They are completely separate individual dogs (objects), that share similar characteristics... all dogs have a gender, size, weight and color. all dogs (probably) can eat, bark, and wag their tail. Given the terms we used to define dogs in our class, those are the characteristics that make a dog, a dog.
Certainly the rabbit hole goes much deeper than that, once you start getting into sub classes, abstract classes, inheritance, etc.. but really, those are the basics. Its only really as complex as you let yourself feel it is. :)
Now, go watch that OO bootcamp series. It's hands down one of the absolute best series on the site! :)
Please or to participate in this conversation.