PSR also known as PHP Standard Recommendation, it is a PHP specification that is used in many standardize programs. Mainly it is used to enable component interoperability and provide a basic technical basis for implementing concepts to improve programming. It is established by the PHP Framework Interop Group. The PSR standards use for example to be able to develop different components for Laravel that work effectively with other frameworks like Symfony.
Here are the main 4 types of PSR as per the Best Web Design Company in India,
1. Accepted
=>PSR-1: Basic Coding Standard
=>PSR-6: Caching Interface
=>PSR-12: Extended Coding Style Guide
2. Deprecated
=>PSR-0: Autoloading Standard
=>PSR-2: Coding Style Guide
3. Draft
=>PSR-5: PHPDoc Standard
=>PSR-19: PHPDoc tags
4. Abandoned
=>PSR-9: Security Advisories
=>PSR-10: Security Reporting Process
Here are some detail information about main PSR’s
PSR-1: Basic Coding standard
Here it includes what should be considered the standard coding parts required to ensure a high level of technical interoperability between shared PHP code.
=>PHP code MUST use only <?php and <?= tags.
=>PHP code MUST use only UTF-8 without BOM.
=>Class names MUST be listed in StudlyCaps.
=>Class constants MUST be reported in all uppercase with underscore separators.
=>Method names MUST be listed in camelCase.
PSR-6: Caching Interface
Caching is a way you can improve the overall performance of the project, making caching libraries is a common feature of many frameworks and libraries.
Here are the main two key concepts,
1. Pool
It represents a collection of items in a caching system. The pool is a valid container of all the items it contains. All cacheable items retrieved from the pool as an item object and all communication of cached objects passes through the pool.
2. Items
The item represents a single or value pair within a Pool. The key is the initial unique identifier for an Item. Also, its value may be changed at any time.
PSR-12: Extended Coding Style Guide
This PSR provides a set that coding style tools can implement, projects can declare adherence to and developers can relate with different projects. When multiple authors collaborate across multiple projects it becomes very helpful to have a set of guidelines to use among all those projects.
==>There must not be a harsh limit on line length.
==>Lines should not be longer than 80 characters
==>There must not be tracing whitespace at the end of the lines.
==>Make sure there must be only one statement per line.
Read more:"Best Web Design Company in India"
Comments
Post a Comment