Generated by GPT-5-mini| PSR (PHP Standard Recommendation) | |
|---|---|
| Name | PSR |
| Caption | PHP Standard Recommendation logo |
| Introduced | 2009 |
| Developer | PHP Framework Interoperability Group |
| Latest | Various published PSRs |
| License | MIT-compatible and community-driven |
PSR (PHP Standard Recommendation) is a set of technical specifications for the PHP programming language developed to promote interoperability among frameworks, librarys, and tools. The recommendations are produced and ratified by an open community body to standardize interfaces and coding practices across disparate software projects, aiming to simplify integration between Composer packages, Symfony components, and other ecosystems. PSR documents influence implementations in projects ranging from Laravel and Zend Framework to Drupal and WordPress plugins.
PSR documents define interfaces, coding styles, autoloading strategies, and messaging formats intended to increase compatibility between CakePHP, Yii, Phalcon, Slim, and independent package authors. They often specify method signatures, class responsibilities, middleware behavior used by ReactPHP integrations, and logger contracts adopted by Monolog, PSR-7 implementations, and PSR-3 logging consumers. Major stakeholders include corporate contributors from Facebook, Google, Microsoft, and community projects such as Composer maintainers and the PHP-FIG organization. The specifications interact with ecosystems like Packagist and deployment tools used by Heroku, AWS, and DigitalOcean.
The standards activity was initiated by members of the PHP community including contributors from Zend Technologies, Fabien Potencier, and teams behind Symfony and Laravel during discussions on inter-framework cooperation. Governance evolved under the PHP Framework Interoperability Group model, with voting members representing projects such as Zend Framework, Symfony, Drupal, Magento, TYPO3, Composer maintainers, and individual contributors from institutions like University of Cambridge research labs and corporate engineering groups at GitHub and GitLab. Formal ratification procedures reflect practices akin to other standards bodies such as the IETF, W3C, and ECMA International, with drafts reviewed on platforms like GitHub, debated at conferences including PHPCon, SymfonyCon, and Laracon. Licensing, contributor agreements, and project code are managed using tools and services provided by entities like Open Source Initiative, Apache Software Foundation, and Mozilla Foundation in collaborative contexts.
Published recommendations cover topics from coding style to HTTP message interfaces. Examples include specifications analogous to coding style guides used by PEAR and interface contracts used by PSR-7 implementations employed by Guzzle and HTTPlug. Many PSRs mirror design patterns popularized by Gang of Four literature and practices from SOLID champions. Implementations and associated projects include Monolog, Guzzle, Zend Diactoros, Nyholm/psr7, Slim, Aura, and adapters for PSR-4 autoloading used in Composer packages. Other related technologies and projects referencing PSRs include PHPUnit, Behat, PHPCS, PHPStan, Psalm, and CI systems provided by Travis CI, CircleCI, and GitHub Actions.
Adoption spans enterprise and community projects such as Magento, Drupal, WordPress, Laravel, Symfony, Zend Framework, TYPO3, Concrete5, OctoberCMS, and microframeworks like Silex. Corporate users include engineering teams at Facebook, Google, Microsoft, Amazon, and startups using Docker and orchestration with Kubernetes on AWS, Azure, and Google Cloud Platform. Tooling for adoption comprises Composer packages on Packagist, static analysis via PHPStan and Psalm, continuous integration with Jenkins, testing with PHPUnit, and documentation using systems like Sphinx and MkDocs. Integrations with web servers and middleware reference implementations support environments such as Nginx, Apache HTTP Server, HHVM, and cloud platforms including Heroku.
Debates have arisen over scope, governance, and backward compatibility, drawing parallels to controversies in Linux kernel development, Systemd adoption debates, and language evolution discussions like those around Python transition from Python 2 to Python 3. Critics from projects reminiscent of PEAR and proprietary vendors have argued about the pace of change, perceived centralization, and the influence of major corporations like Zend Technologies and Fabien Potencier-led teams. Other disputes echo tensions seen in committees such as IETF working groups and standards disputes involving ECMAScript stewardship. Security implications and versioning choices have prompted discourse among maintainers of Symfony, Laravel, Drupal, Magento, and independent package authors on mailing lists, issue trackers, and at conferences like PHPCon.
PSR documents follow versioning strategies influenced by Semantic Versioning practices and version control workflows established by Git, with publication and errata managed publicly on repositories hosted by GitHub and mirrored via GitLab. Maintenance involves contributors from project teams including Symfony, Laravel, Zend Framework, Drupal, Composer maintainers, and independent maintainers using branching and pull request models similar to protocols used by Linux and FreeBSD projects. Backwards compatibility, deprecation policies, and migration guidance reference principles from Semantic Versioning and are discussed in issue trackers, at working sessions, and during community events like SymfonyCon and Laracon.