Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHP and Standards

PHP and Standards

The PHP FIG is a group established in 2010 with the aim of putting together a set of best practices for PHP apps to follow. Five PSRs have been accepted and a few proposals are currently under discussion. These PSRs are designed to make it easier for people to build packages that work with each other by providing interfaces that they can implement without enforcing an implementation. This talk will cover the existing PSRs and the ones that are under consideration, and will then take a brief look at the de facto standards that people use to fulfil the requirements of each PSR

Michael Heap

May 20, 2015
Tweet

More Decks by Michael Heap

Other Decks in Technology

Transcript

  1. Agavi - David Zülke Cake - Nate Abele PEAR -

    Brett Bieber, David Coallier, Helgi Þormar Þorbjörnsson, Travis Swicegood, Phing - Travis Swicegood Solar - Paul Jones Symfony - Stefan Koopmanschap Zend Framework - Matthew Weier O'Phinney and the always amiable (i.e., at-large community member), Cal Evans. May 21st, 2009
  2. Tek_Demo_Example => Tek/Demo/Example.php Tek_Demo_Foo => Tek/Demo/Foo.php Tek_Something => Tek/Something.php Datasift\Filter\Sentiment

    => Datasift/Filter/Sentiment.php Datasift\Service\Auth => Datasift/Service/Auth.php Datasift\User => Datasift/User.php
  3. There MUST be one space after the control structure keyword

    There MUST NOT be a space after the opening parenthesis There MUST NOT be a space before the closing parenthesis There MUST be one space between the closing parenthesis and the opening brace
  4. # Breaks PSR2 if ('awesome' == $tek){ } # Valid.

    Adds the space # before the opening brace if ('awesome' == $tek) { }
  5. Emergency – the system is unusable Alert – immediate action

    is required Critical – critical conditions Error – errors that do not require immediate attention but should be monitored Warning – unusual or undesirable occurrences that are not errors Notice – normal but significant events Info – interesting events Debug – detailed information for debugging purposes
  6. PSR-0 PSR-1 PSR-2 PSR-3 PSR-4 PSR-7 Autoloading Basic Coding Coding

    Style Guide Logger Interface Autoloading HTTP Message Interface