What are the content of the series of PHP's SRS specifications and what are the phpsrs specifications? _ PHP Tutorial

Source: Internet
Author: User
What are the content of PHP's series of SRS, and what are the phppsr specifications. In PHP, what are the content of the series of SRS, and what are the descriptions of the phppsr specifications? this is short for PHPStandardRecommendation. it should actually be called PSRs, which is the series of recommendation standards: currently, the accepted specifications include what is included in the srs php series, and what are included in the phppsr specifications?
PSR

Is short for PHP Standard Recommendation, it should actually be called PSRs, that is, the series of Recommendation standards: currently through the specification of PSR-0 (Autoloading Standard), PSR-1 (Basic Coding Standard), PSR-2 (Coding Style Guide), PSR-3 (Logger Interface), PSR-4 (Improved Autoloading ). It is not an official PHP standard, but a series of standards extracted from well-known PHP projects such as Zend and Symfony2. Currently, more community projects are joining members and following this standard.

PHP-FIG-PHP Framework Interoperability Group is an organization that develops PSRs development specifications. its members are composed of many well-known PHP community projects and can be seen at the bottom of its home page. These members develop specifications and implement them in their own projects.

In fact, the content of various DSRs specifications is concise and clear, which is much better than the dozens of pages of those specifications.

PSR-0 (Autoloading Standard)

PSR-0 is class automatic loading specification (original: Official Site, GitHub ). The specification was markedDeprecated, Replaced by a PSR-4. Its content is very concise.

Content:

PSR-1 (Basic Coding Standard)

PSR-1 is the basic encoding standard (original: official website, GitHub ). Whether the content is concise, including the class file, class name, class method name naming method.

Content:

PSR-2 (Coding Style Guide)

PSR-2 is the encoding style standard (original: Official Site, GitHub ). The content is a little more, but it is relatively simple, it is based on the PSR-1, contains indentation, the length of each line of code, line feed, method visibility statement, space and method body braces wrap related provisions.

Standard content:

The PSR-3 (Logger Interface)

PSR-3 is the definition of the application log class through the interface (original: official website, GitHub ). The content is very simple, it is an interface, just reference the official sample code. Of course, in a specific application, as long as you follow this interface, you can certainly customize the corresponding implementation.

Basic content:

PSR-4 (Improved Autoloading)

PSR-4 is the domestic version of the automatic loading specification (original: Official Site, GitHub ). It is a replacement for PSR-0 specifications. It can be compatible with any other automatic loading specification, including PSR-0.

Content:

  • When a file is loaded from a fully qualified class name:
  • The implementation of the automatic loader cannot throw any exceptions, and cannot cause any errors of any level; nor should it return values.

  • Note: for specific provisions, refer to other Chinese translation versions.

    The latest PSR is short for PHP Standard Recommendation. it should actually be called PSRs, which is a series of Recommendation standards. Currently, the accepted specifications include this...

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.