PHP naming conventions about abstract classes and interfaces

Although there's not any convention, I think it is a good practice using Abstract prefix and Interface suffix for respective components. It helps to understand better the code at a glance, IMO.


The PHP-FIG project indeed suggests a naming convention via the PSR Naming Convention "ByLaw" https://www.php-fig.org/bylaws/psr-naming-conventions/

It states:

  • Interfaces MUST be suffixed by Interface: e.g. Psr\Foo\BarInterface

  • Abstract classes MUST be prefixed by Abstract: e.g. Psr\Foo\AbstractBar

  • Traits MUST be suffixed by Trait: e.g. Psr\Foo\BarTrait

These conventions are generally followed in packages