This group was initiated by some framework developers in php|tek in 2009, from the first 5 to more than 20 now.
There are many numbers in the "PHP Standard Recommendations", each number represents a different specification .
E.g:
PHP standard recommendation number 1 ( PSR-1 ), the basic coding standard . For example, the name of the class (Class) must be declared as StudlyCaps, the name of the method (Method) must be declared as camelCase.. etc.
The PHP standard recommendation number 2 ( PSR-2 ) is an extension of PSR-1, which regulates the PHP coding style , such as extends or implements must be on the same line as the class name...etc.
PHP standard recommendation number 4 ( PSR-4 ) defines automatic loading ( Autoloader standard ), Composer is also a member of FIG ,
For example, in the current Laravel framework, his composer.json can see the trace of using PSR-4 automatic loading,
Because the automatic loading of PSR-0 has been listed as deprecated (DEPRECATED), but there is still support in composer , if you really want to use it.
In the table below, I list the approved specifications, and of course there are also those in the review and draft stages. If you are interested, please refer to the link on the right: Recommendations (PSRs)
Num | Title | Editor | Coordinator | Sponsors |
---|---|---|---|---|
1 | Basic Coding Standard | Paul M. Jones | N/A | N/A |
2 | Coding Style Guide | Paul M. Jones | N/A | N/A |
3 | Logger Interface | Jordi Boggiano | N/A | N/A |
4 | Autoloading Standard | Paul M. Jones | Phil Sturgeon | Larry Garfield |
6 | Caching Interface | Larry Garfield | Paul Dragoonis | Robert Hafner |
7 | HTTP Message Interface | Matthew Weier O'Phinney | Beau Simensen | Paul M. Jones |
11 | Container Interface | Matthieu Napoli, David Negrir | Matthew Weier O'Phinney | Korvin Szanto |
13 | Hypermedia Links | Larry Garfield | Matthew Weier O'Phinney | Marc Alexander |
16 | Simple Cache | Paul Dragoonis | Jordi Boggiano | Fabien Potencier |
Take PSR-7 HTTP Message Interface as an example:
The reqeust and response objects in the Slim framework support the PSR-7 interface, which makes Slim very free to use any PSR-7 implementation.
E.g:
The route of the Slim program can not return the
\Slim\Http\Response
instance. It can return the \GuzzleHttp\Psr7\CachingStream
instance,Although Slim provides a PSR-7 implementation, we are free to change the default PSR 7 objects in Slim to other third-party implementations.
In the Laravel framework, we can obtain a PSR-7 instance reqeust instead of Laravel's request by installing a library. |
|
Once we installed these kits, we were able to get the PSR-7 requirements. |
|
No Comment
Post your comment