4. Framework Interoperability Group - FIG
◦ Michael Dowling (AWS SDK for PHP)
◦ Larry Masters (CakePHP)
◦ Guilherme Blanco (Doctrine)
◦ Larry Garfield (Drupal)
◦ Filipe Guerra (SugarCRM)
◦ Bernhard Schussek (Symfony2)
◦ Alexander Makarov (Yii framework)
◦ Pádraic Brady (Zend Framework 2)
5. FIG’s Goal
The goal of the FIG is to create a dialogue
between project representatives, with the
aim of finding ways to work together
(interoperability)
7. Tools
require() in PHP 4
__autoload() in PHP 5
spl_autoload() and spl_autoload_register() in PHP 5.1.2
8. Requirements
◦ A fully-qualified namespace and class must have the following structure
<Vendor Name>(<Namespace>)*<Class Name>
◦ Each namespace must have a top-level namespace ("Vendor Name").
◦ Each namespace can have as many sub-namespaces as it wishes.
◦ Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system.
◦ Each _ character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The _ character has no
special meaning in the namespace.
◦ The fully-qualified namespace and class is suffixed with .php when loading from the file system.
◦ Alphabetic characters in vendor names, namespaces, and class names may be of any combination of
lower case and upper case.
12. Basic Coding Standard
◦ Only use the <?php and <?= tags.
◦ Only use UTF-8 without BOM for PHP code.
◦ Separate side-effects (generate output, access a database etc.) and declarations.
◦ Enforce PSR-0.
◦ Class names must be defined in StudlyCaps.
◦ Class constants must be defined in upper case with underscore separators.
◦ Method names must be defined in camelCase.
16. Logger Interface
◦ The LoggerInterface exposes eight methods to write logs to the eight RFC 5424 levels (debug, info,
notice, warning, error, critical, alert, emergency)
◦ A ninth method, log, accepts a log level as first argument. Calling this method with one of the log level
constants MUST have the same result as calling the level-specific method. Calling this method with a
level not defined by this specification MUST throw a PsrLogInvalidArgumentException if the
implementation does not know about the level. Users SHOULD NOT use a custom level without knowing
for sure the current implementation supports it.
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
No matter how good the autoloading functionality is, it does not define how to implement it with existing codebases. For example, library X might approach the directory and classname structure differently than library Y, but you might want to use both!
Writing a proper autoloader that knows where to look for all possible fully-qualified names, as well as test all file extensions (.class.php, inc.php, .php etc) will quickly become a mess.