Inheritance: A child class extends a parent class and inherits its properties and methods. AdminUser extends User — it has everything User has, plus admin-specific permissions. Inheritance lets a class extend another class and reuse its properties and methods. An AdminUser that extends User has everything a user has, plus admin-specific behaviour.
It is a natural fit for real "is a" relationships and for frameworks that give you a base class to build on, such as Laravel's Model or Controller.
What should you keep in mind with Inheritance?
Used heavily, it causes problems. Deep hierarchies are hard to follow, and a change in a parent class can break children in unexpected ways. The common advice is to prefer composition: give a class the helpers it needs as separate objects, rather than inheriting from a chain of parents. Traits and interfaces in PHP offer other ways to share behaviour. Keep inheritance shallow, usually one or two levels.
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.