Naming conventions for code released by PHP FIGΒΆ
- 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
.
- PSR-1, 4, and 12 MUST be followed.
- For code released as part of a PSR, the vendor namespace MUST be
Psr
and the Composer package name MUST be psr/<package>
(e.g., psr/log
).
- For code released as part of a PER or any other Auxiliary Resources, the vendor namespace MUST be
Fig
and the Composer package name MUST be fig/<package>
(e.g., fig/cache-util
).
- There MUST be a package/second-level namespace in relation with the PSR or PER that covers the code.
- Implementations of a given PSR or PER SHOULD declare a
provides
key in their composer.json
file in the form psr/<package>-implementation
with a version number that matches the PSR being implemented. For example, "psr/<package>-implementation": "1.0.0"
.