Class: A blueprint or template describing what an object looks like and what it can do. Like architectural plans — the plans are not a building, but you build from them. A class is a blueprint for objects. It describes what data an object holds, its properties, and what it can do, its methods. An Invoice class might hold a number, a customer and lines, and offer methods like total() and send().
Each object created from the class is an instance with its own data. Two invoices share the same structure and behaviour but have different numbers and amounts.
What should you keep in mind with Class?
Good classes are focused. A class that handles invoices, sends emails, talks to the accounting system and builds PDFs is hard to test and hard to change. Split responsibilities so each class has one clear job. In frameworks like Laravel, models, controllers, jobs and services are all classes with a specific role, and keeping to those roles keeps a codebase easy to work in.
Apply Spatie's Laravel and PHP coding standards for any task that creates, edits, reviews, refactors, or formats Laravel/PHP code or Blade templates; use for controllers, Eloquent models, routes, config, validation, migrations, tests, and related files to align with Laravel conventions and PSR-12.
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.