The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
- Introduction
The goal for this specification is to extend PSR-0 and to provide an alternative option for applications to determine the location of a file resource on a medium as supported by PHP, when a fully-qualified class name is provided.
- Scope
This specification is partly backwards incompatible with PSR-0. Where a conflict occurs the rules in this specification precede, or override, the rules in PSR-0.
- Specification
- The
_
character has no special meaning in class names. - For a collection of one or more classes a namespace prefix MUST be documented.
- The documented namespace prefix MUST be a valid namespace for each class in the collection.
- The portion of the fully-qualified class name following the namespace prefix must be considered the fully-qualified class name for the purpose of transformation into a filename.
- A conforming autoloader MUST NOT interfere with other autoloaders, and as such it MUST NOT throw exceptions, MUST NOT raise errors of any level, and SHOULD NOT return a value.
- Examples
- Given a namespace prefix
\Doctrine\Common
and a fully-qualified class name\Doctrine\Common\IsolatedClassLoader
, the resulting filename would beIsolatedClassLoader.php
. - Given a namespace prefix
\Doctrine
and a fully-qualified class name\Doctrine\Common\IsolatedClassLoader
, the resulting filename would beCommon/IsolatedClassLoader.php
. - Given a namespace prefix
\Symfony\Component\HttpFoundation
and a fully-qualified class name\Symfony\Component\HttpFoundation\Request
, the resulting filename would beRequest.php
. - Given a namespace prefix
\Symfony
and a fully-qualified class name\Symfony\Component\HttpFoundation\Request
, the resulting filename would beComponent/HttpFoundation/Request.php
. - Given a namespace prefix
\Zend
and a fully-qualified class name\Zend\Acl
, the resulting filename would beAcl.php
. - Given a namespace prefix
\Acme\My_Project
and a fully-qualified class name\Acme\My_Project\Some_module\some_class
, the resulting filename would beSome_module/some_class.php
.
👍