SlideShare a Scribd company logo
PHP
Standards
Recommendation
(PSR)
Biswajeet Parida
● Introduction
● List
● Overview
Agenda
INTRO
● The PHP Standard Recommendation (PSR) is a PHP
specification published by the PHP Framework Interop Group.
● It serves the standardization of programming concepts in PHP.
● The aim is to enable interoperability of components.
● The PHP-FIG is formed by several PHP frameworks founders.
PSR-0 Autoloading Standard X
PSR-1 Basic Coding Standard A
PSR-2 Coding Style Guide A
PSR-3 Logger Interface A
PSR-4 Autoloading Standard A
PSR-5 PHPDoc Standard D
PSR-6 Caching Interface A
PSR-7 HTTP Message Interface A
PSR-8 Huggable Interface D
PSR-9 Security Advisories D
PSR-10 Security Reporting Process D
PSR-11 Container Interface A
PSR-12 Extended Coding Style Guide D
PSR-13 Hypermedia Links A
PSR-14 Event Manager D
PSR-15 HTTP Middlewares D
PSR-16 Simple Cache A
PSR-17 HTTP Factories D
X : Deprecated_
A : Accepted
D : Draft
PSR-1: Basic Coding Standard
● Files MUST use only <?php and <?= tags.
● Files MUST use only UTF-8 without BOM for PHP code.
● Files SHOULD either declare symbols or cause side-effects but
SHOULD NOT do both.
● Namespaces and classes MUST follow an “autoloading” PSR: [PSR-0,
PSR-4].
● Class names MUST be declared in StudlyCaps.
● Class constants MUST be declared in all uppercase with underscore
separators.
● Method names MUST be declared in camelCase.
PSR-2: Coding Style Guide
● Code MUST follow a “coding style guide” PSR [PSR-1].
● Code MUST use 4 spaces for indentation, not tabs.
● There MUST NOT be a hard limit on line length; the soft limit MUST be
120 characters; lines SHOULD be 80 characters or less.
● There MUST be one blank line after the namespace declaration, and
there MUST be one blank line after the block of use declarations.
● Opening braces for classes MUST go on the next line, and closing braces
MUST go on the next line after the body.
● Opening braces for methods MUST go on the next line, and closing
braces MUST go on the next line after the body.
● Visibility MUST be declared on all properties and methods; abstract and
final MUST be declared before the visibility; static MUST be declared after
the visibility.
● Control structure keywords MUST have one space after them; method
and function calls MUST NOT.
● Opening braces for control structures MUST go on the same line, and
closing braces MUST go on the next line after the body.
● Opening parentheses for control structures MUST NOT have a space
after them, and closing parentheses for control structures MUST NOT
have a space before.
PSR-3: Logger Interface
● The main goal is to allow libraries to receive a PsrLogLoggerInterface
object and write logs to it in a simple and universal way.
● Frameworks and CMSs that have custom needs MAY extend the
interface for their own purpose, but SHOULD remain compatible with
this document.
● This ensures that the third-party libraries an application uses can write to
the centralized application logs.
PSR-4: Autoloader
● This PSR describes a specification for autoloading classes from file
paths.
● It is fully interoperable, and can be used in addition to any other
autoloading specification, including PSR-0.
● This PSR also describes where to place files that will be autoloaded
according to the specification.
PSR-0 vs PSR-4
PSR-6: Caching Interface
● Cache-aware libraries that can be integrated into existing
frameworks and systems without the need for custom
development.
PSR-7: HTTP message interfaces
● The first line of a request is the “request line”, and contains, in
order, the HTTP request method, the request target (usually
either an absolute URI or a path on the web server), and the
HTTP protocol version.
● This is followed by one or more HTTP headers, an empty line,
and the message body.
PSR-11: Container interface
● Standardize how frameworks and libraries make use of a
container to obtain objects and parameters.
PSR-13: Link definition interfaces
● Serialize a response with hypermedia links into one or more
wire formats independently of the process of deciding what
those links should be.
PSR-16: Common Interface for
Caching Libraries
● Libraries can drop their own caching implementations and easily rely on
the one given to them by the framework, or another dedicated cache
library.
● It is independent of PSR-6 but has been designed to make compatibility
with PSR-6 as straightforward as possible.
CONCLUSION
The PHP Standard Recommendation is about how you should write
your code so that it’ll be easily readable and usable by others. It
covers coding style, file organization, autoloading and standardizes
various interfaces.
THANKS!
QUESTIONS?

More Related Content

What's hot

Learn REST API with Python
Learn REST API with PythonLearn REST API with Python
Learn REST API with Python
Larry Cai
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
Doncho Minkov
 

What's hot (20)

Learn REST API with Python
Learn REST API with PythonLearn REST API with Python
Learn REST API with Python
 
Practical non blocking microservices in java 8
Practical non blocking microservices in java 8Practical non blocking microservices in java 8
Practical non blocking microservices in java 8
 
Python Basics.pdf
Python Basics.pdfPython Basics.pdf
Python Basics.pdf
 
Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...
 
Rest API
Rest APIRest API
Rest API
 
Flask for cs students
Flask for cs studentsFlask for cs students
Flask for cs students
 
Introduction to python programming, Why Python?, Applications of Python
Introduction to python programming, Why Python?, Applications of PythonIntroduction to python programming, Why Python?, Applications of Python
Introduction to python programming, Why Python?, Applications of Python
 
Cara install apache, mysql, php, dan phpmyadmin pada freebsd 10
Cara install apache, mysql, php, dan phpmyadmin pada freebsd 10Cara install apache, mysql, php, dan phpmyadmin pada freebsd 10
Cara install apache, mysql, php, dan phpmyadmin pada freebsd 10
 
COMO EXECUTAR SCRIPT PYTHON com JS
COMO EXECUTAR SCRIPT PYTHON com JSCOMO EXECUTAR SCRIPT PYTHON com JS
COMO EXECUTAR SCRIPT PYTHON com JS
 
Abstract Factory Design Pattern
Abstract Factory Design PatternAbstract Factory Design Pattern
Abstract Factory Design Pattern
 
PHP, Under The Hood - DPC
PHP, Under The Hood - DPCPHP, Under The Hood - DPC
PHP, Under The Hood - DPC
 
Escrevendo modulos python com rust
Escrevendo modulos python com rustEscrevendo modulos python com rust
Escrevendo modulos python com rust
 
Istio's mixer policy enforcement with custom adapters (cloud nativecon 17)
Istio's mixer  policy enforcement with custom adapters (cloud nativecon 17)Istio's mixer  policy enforcement with custom adapters (cloud nativecon 17)
Istio's mixer policy enforcement with custom adapters (cloud nativecon 17)
 
Php internal architecture
Php internal architecturePhp internal architecture
Php internal architecture
 
OpenAPI Intro (1).pdf
OpenAPI Intro (1).pdfOpenAPI Intro (1).pdf
OpenAPI Intro (1).pdf
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC Framework
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
C# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkC# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net Framework
 
How To Install Python Pip On Windows | Edureka
How To Install Python Pip On Windows | EdurekaHow To Install Python Pip On Windows | Edureka
How To Install Python Pip On Windows | Edureka
 
Python-DataAbstarction.pptx
Python-DataAbstarction.pptxPython-DataAbstarction.pptx
Python-DataAbstarction.pptx
 

Similar to An intro to php standards recommendation (psr)

Php psr standard 2014 01-22
Php psr standard 2014 01-22Php psr standard 2014 01-22
Php psr standard 2014 01-22
Võ Duy Tuấn
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
Tim Burks
 

Similar to An intro to php standards recommendation (psr) (20)

Php psr standard 2014 01-22
Php psr standard 2014 01-22Php psr standard 2014 01-22
Php psr standard 2014 01-22
 
Cloud Native API Design and Management
Cloud Native API Design and ManagementCloud Native API Design and Management
Cloud Native API Design and Management
 
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
 
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
 
Build a Micro HTTP Server for Embedded System
Build a Micro HTTP Server for Embedded SystemBuild a Micro HTTP Server for Embedded System
Build a Micro HTTP Server for Embedded System
 
Introduction to Apache Beam
Introduction to Apache BeamIntroduction to Apache Beam
Introduction to Apache Beam
 
Micro HTTP Server Implemented in C @ COSCUP 2016
Micro HTTP Server Implemented in C @ COSCUP 2016Micro HTTP Server Implemented in C @ COSCUP 2016
Micro HTTP Server Implemented in C @ COSCUP 2016
 
HTTP In-depth
HTTP In-depthHTTP In-depth
HTTP In-depth
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
 
PHP Standards Recommendations - PHP-FIG
PHP Standards Recommendations - PHP-FIGPHP Standards Recommendations - PHP-FIG
PHP Standards Recommendations - PHP-FIG
 
ARM AAE - Developing Code for ARM
ARM AAE - Developing Code for ARMARM AAE - Developing Code for ARM
ARM AAE - Developing Code for ARM
 
Micro HTTP Server for Embedded
Micro HTTP Server for EmbeddedMicro HTTP Server for Embedded
Micro HTTP Server for Embedded
 
Securing Infrastructure with OpenScap The Automation Way !!
Securing Infrastructure with OpenScap The Automation Way !!Securing Infrastructure with OpenScap The Automation Way !!
Securing Infrastructure with OpenScap The Automation Way !!
 
Towards constrained semantic web
Towards constrained semantic webTowards constrained semantic web
Towards constrained semantic web
 
Sf rmr - Servicing Forwarding Remote Multiplexing Relay
Sf rmr - Servicing Forwarding Remote Multiplexing RelaySf rmr - Servicing Forwarding Remote Multiplexing Relay
Sf rmr - Servicing Forwarding Remote Multiplexing Relay
 
OpenDataPlane - Bill Fischofer
OpenDataPlane - Bill FischoferOpenDataPlane - Bill Fischofer
OpenDataPlane - Bill Fischofer
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
 
Download It
Download ItDownload It
Download It
 
2021.laravelconf.tw.slides2
2021.laravelconf.tw.slides22021.laravelconf.tw.slides2
2021.laravelconf.tw.slides2
 
Psr 2 coding style guide - Tidepool Labs
Psr 2   coding style guide - Tidepool LabsPsr 2   coding style guide - Tidepool Labs
Psr 2 coding style guide - Tidepool Labs
 

More from valuebound

How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.
valuebound
 
How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound
valuebound
 
The Benefits of Cloud Engineering
The Benefits of Cloud EngineeringThe Benefits of Cloud Engineering
The Benefits of Cloud Engineering
valuebound
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
valuebound
 
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
valuebound
 

More from valuebound (20)

Scaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic WebsitesScaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic Websites
 
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdfDrupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
 
How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.
 
How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound
 
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js AppsHow to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
 
Mastering Drupal Theming
Mastering Drupal ThemingMastering Drupal Theming
Mastering Drupal Theming
 
The Benefits of Cloud Engineering
The Benefits of Cloud EngineeringThe Benefits of Cloud Engineering
The Benefits of Cloud Engineering
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
 
Deep dive into ChatGPT
Deep dive into ChatGPTDeep dive into ChatGPT
Deep dive into ChatGPT
 
Content Creation Solution | Valuebound
Content Creation Solution | ValueboundContent Creation Solution | Valuebound
Content Creation Solution | Valuebound
 
Road ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projectsRoad ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projects
 
Chatbot with RASA | Valuebound
Chatbot with RASA | ValueboundChatbot with RASA | Valuebound
Chatbot with RASA | Valuebound
 
Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization
 
Drupal growth in last year | Valuebound
Drupal growth in last year | ValueboundDrupal growth in last year | Valuebound
Drupal growth in last year | Valuebound
 
BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"
 
Event loop in browser
Event loop in browserEvent loop in browser
Event loop in browser
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
Dependency Injection in Drupal 8
Dependency Injection in Drupal 8Dependency Injection in Drupal 8
Dependency Injection in Drupal 8
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 

An intro to php standards recommendation (psr)

  • 3. INTRO ● The PHP Standard Recommendation (PSR) is a PHP specification published by the PHP Framework Interop Group. ● It serves the standardization of programming concepts in PHP. ● The aim is to enable interoperability of components. ● The PHP-FIG is formed by several PHP frameworks founders.
  • 4. PSR-0 Autoloading Standard X PSR-1 Basic Coding Standard A PSR-2 Coding Style Guide A PSR-3 Logger Interface A PSR-4 Autoloading Standard A PSR-5 PHPDoc Standard D PSR-6 Caching Interface A PSR-7 HTTP Message Interface A PSR-8 Huggable Interface D PSR-9 Security Advisories D PSR-10 Security Reporting Process D PSR-11 Container Interface A PSR-12 Extended Coding Style Guide D PSR-13 Hypermedia Links A PSR-14 Event Manager D PSR-15 HTTP Middlewares D PSR-16 Simple Cache A PSR-17 HTTP Factories D X : Deprecated_ A : Accepted D : Draft
  • 5. PSR-1: Basic Coding Standard ● Files MUST use only <?php and <?= tags. ● Files MUST use only UTF-8 without BOM for PHP code. ● Files SHOULD either declare symbols or cause side-effects but SHOULD NOT do both. ● Namespaces and classes MUST follow an “autoloading” PSR: [PSR-0, PSR-4]. ● Class names MUST be declared in StudlyCaps. ● Class constants MUST be declared in all uppercase with underscore separators. ● Method names MUST be declared in camelCase.
  • 6.
  • 7. PSR-2: Coding Style Guide ● Code MUST follow a “coding style guide” PSR [PSR-1]. ● Code MUST use 4 spaces for indentation, not tabs. ● There MUST NOT be a hard limit on line length; the soft limit MUST be 120 characters; lines SHOULD be 80 characters or less. ● There MUST be one blank line after the namespace declaration, and there MUST be one blank line after the block of use declarations. ● Opening braces for classes MUST go on the next line, and closing braces MUST go on the next line after the body.
  • 8. ● Opening braces for methods MUST go on the next line, and closing braces MUST go on the next line after the body. ● Visibility MUST be declared on all properties and methods; abstract and final MUST be declared before the visibility; static MUST be declared after the visibility. ● Control structure keywords MUST have one space after them; method and function calls MUST NOT. ● Opening braces for control structures MUST go on the same line, and closing braces MUST go on the next line after the body. ● Opening parentheses for control structures MUST NOT have a space after them, and closing parentheses for control structures MUST NOT have a space before.
  • 9.
  • 10. PSR-3: Logger Interface ● The main goal is to allow libraries to receive a PsrLogLoggerInterface object and write logs to it in a simple and universal way. ● Frameworks and CMSs that have custom needs MAY extend the interface for their own purpose, but SHOULD remain compatible with this document. ● This ensures that the third-party libraries an application uses can write to the centralized application logs.
  • 11. PSR-4: Autoloader ● This PSR describes a specification for autoloading classes from file paths. ● It is fully interoperable, and can be used in addition to any other autoloading specification, including PSR-0. ● This PSR also describes where to place files that will be autoloaded according to the specification.
  • 13. PSR-6: Caching Interface ● Cache-aware libraries that can be integrated into existing frameworks and systems without the need for custom development.
  • 14. PSR-7: HTTP message interfaces ● The first line of a request is the “request line”, and contains, in order, the HTTP request method, the request target (usually either an absolute URI or a path on the web server), and the HTTP protocol version. ● This is followed by one or more HTTP headers, an empty line, and the message body.
  • 15. PSR-11: Container interface ● Standardize how frameworks and libraries make use of a container to obtain objects and parameters.
  • 16. PSR-13: Link definition interfaces ● Serialize a response with hypermedia links into one or more wire formats independently of the process of deciding what those links should be.
  • 17. PSR-16: Common Interface for Caching Libraries ● Libraries can drop their own caching implementations and easily rely on the one given to them by the framework, or another dedicated cache library. ● It is independent of PSR-6 but has been designed to make compatibility with PSR-6 as straightforward as possible.
  • 18. CONCLUSION The PHP Standard Recommendation is about how you should write your code so that it’ll be easily readable and usable by others. It covers coding style, file organization, autoloading and standardizes various interfaces.