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

FIG

Michael C.
September 10, 2013

 FIG

Michael C.

September 10, 2013
Tweet

More Decks by Michael C.

Other Decks in Programming

Transcript

  1. phpBB Propel Symfony PPI AWS Zend Framework Apache Agavi Assetic

    Aura Cake PHP Composer Doctrine eZ Publish Flow/Typo3 Jackalope Joomla Lithium Laravel PEAR phpDocumenter Drupal PyroCMS SabreDEV Sugar CRM Zikula
  2. PSR-0 • How to autoload libraries • Very simple terms:

    • Namespace is formatted as <vendor>/<package>/<namespace>/<classname> • Acme/Foo/Bar/MyClass will exist as a class in file: Acme/Foo/Bar/MyClass.php • Composer does this.  • Problem: Composer will put Acme’s Foo Project in /vendor/acme/foo/ resulting in the following directory nesting: /vendor/acme/foo/acme/foo/bar/myclass.php
  3. PSR-1 • Coding Standards that affect interop • Such as

    file must have logic or affect behaviour but not both, line endings & Encoding • Used often in conjunction with PSR-2
  4. PSR-2 • Extends (Requires/Includes PSR-1) • Coding standards such as

    where to have brackets, spaces etc. • Spaces vs Tabs • Called a guide, not a standard • Not really for interop, just continuity and allows many libs to not have to create their own. • CS Fixers
  5. PSR-3 • A common interface for logging libraries to use

    and applications to expect. • Common Interfaces make libs interchangeable. • First of many… • GH: php-fig/log • Composer: fig/log
  6. CACHING • Another interface • Allows caching libraries and for

    frameworks to share a cache or drop caching libs in and out • In the making for a long time. Hopefully in the next couple of months should go through.
  7. Package Orientated Autoloader • Solves the problem of /vendor/acme/foo/acme/foo/bar/myclass.php •

    Allows Acme/Foo/Bar/MyClass to map to a custom directory. • /vendor/acme/foo/bar/myclass.php • Composer will support this
  8. PHPDoc • Standard for Docblocs • Allows you to interchange

    & share API Generators (phpDocumenter etc.) Docbloc Example: /** * Get user id from username * * @param string $username User’s Name * @return int Users’ Id */
  9. Getting Involved • Using the PSRs: Github - php-fig/fig-standards http://php-fig.org

    • Help work on the PSRs: Contribute on the ML. Google Groups. Link on the website.
  10. Getting Involved • Become a voting member: Apply on the

    ML. NB: Projects apply, not people. • Spread the word: Write a blog post, recommend usage, explain to colleagues.