Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Le groupe PHP-FIG et les standards PSR

3,071 views

Published on

Le groupe PHP-FIG s'est formé pour favoriser l'interopérabilité des frameworks PHP.

Découvrez l'organisation et le fonctionnement du FIG, et les standards PHP PSR-0/PSR-4 pour l'autoloading, PSR-1/PSR-2 pour les normes de codage, PSR-3 pour le logging, les autres standards en cours d'élaboration: PSR-5 pour PHPdoc, PSR-6 pour le cache, et toutes les discussions en cours sur la standardisation PHP.

Présentation donnée au meetup AFUP du 02/04/2014.

Published in: Software
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • -- DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT -- ......................................................................................................................... ......................................................................................................................... Download FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... (Unlimited)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • ACCESS that WEBSITE Over for All Ebooks (Unlimited) ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... DOWNLOAD FULL EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M }
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Le groupe PHP-FIG et les standards PSR

  1. 1. 1/37 | PHP_FIG-14D02 | © 2014 OSInet PHP-FIG / PSR Frédéric G. Marand
  2. 2. 2/37 | PHP_FIG-14D02 | © 2014 OSInet « Interopérabilité des frameworks » Paris, 02/04/2014
  3. 3. 3/37 | PHP_FIG-14D02 | © 2014 OSInet
  4. 4. 4/37 | PHP_FIG-14D02 | © 2014 OSInet Le PHP-FIG Les PSR en vigueur Les PSR en cours Les autres PSR
  5. 5. 5/37 | PHP_FIG-14D02 | © 2014 OSInet FIG: Ordre de Mission ● En une phrase: ● faciliter l'interop rabilité é ● des frameworks ● entre eux ● Pas concern par:é ● le fonctionnement interne des frameworks ● les sites et applications livrables ● le fonctionnement de PHP (internals)
  6. 6. 6/37 | PHP_FIG-14D02 | © 2014 OSInet FIG: objectifs initiaux ● Utilisation des namespaces ● En 2009: nouveauté ● Nommage en POO ● Classes, interfaces, classes de bases abstraites ● Pas de traits: introduits en PHP 5.4 (2010) ● Utilisation des exceptions http://news.php.net/php.standards/2
  7. 7. 7/37 | PHP_FIG-14D02 | © 2014 OSInet FIG: structure ● 19-22/05/09: php-tek Chicago ● R union inopin eé é ● Agavi, CakePHP, PEAR, Phing, Solar, Symfony, Zend Framework, «community-at-large» ● 23/05: Cr ation de la liste priv e «php-standards»é é ● D but des malentendus avec la communauté é ● 02/06: premier membre non fondateur ● Drupal demande participerà ● 09/06: Ouverture de la liste ● Sous la pression de Rasmus Lerdorf ● Aujourd'hui, 38 projets participants http://news.php.net/php.standards/29
  8. 8. 8/37 | PHP_FIG-14D02 | © 2014 OSInet
  9. 9. 9/37 | PHP_FIG-14D02 | © 2014 OSInet FIG: organisation ● Membres = projets, != personnes ● 1 projet = 1 voix ● 32k devs Drupal == 37 devs Contao ● S lection des nouveaux entrantsé ● n projets = 1 voix ● Aura/Solar, Composer/Packagist, [Media]Wiki[data] ... ● Assetic/Buzz, Silex/Symfony ● Tous les autres projets = 1 voix https://groups.google.com/forum/#!topic/php-fig/-twbCjA6EPM
  10. 10. 10/37 | PHP_FIG-14D02 | © 2014 OSInet FIG: membres non votants ● Chacun peut participer ● La participation est vraiment prise en compte ● Ex: Beau Simensen (Sculpin, Silex) ● Ex: PSR-3 : – inspir par Monologé – tendu par 3 membres de Drupal mais 1 seule voixé
  11. 11. 11/37 | PHP_FIG-14D02 | © 2014 OSInet FIG: pour qui ? ● Les frameworks PHP ● Rapidement tendu aux CMS et bases d'applicationsé ● Focus sur l'interop rabilité é ● Pas pour tous ● Pas les utilisateurs PHP en g n ralé é – Mais ils sont impact s par les choix de leurs outilsé ● Le rejet l' poque «standards»à é ● Pas les d veloppeurs d'extensions PHPé
  12. 12. 12/37 | PHP_FIG-14D02 | © 2014 OSInet FIG: les livrables ● PHP Standards Recommendation ● https://github.com/php-fig/fig-standards/tree/master/accepted ● Licence texte: CC BY 3.0 ● Licence code: MIT ● Formalisme: RFC 2119 ● Traductions: officielles ● Application ● M me les membres ne sont pas li s par les PSRê é
  13. 13. 13/37 | PHP_FIG-14D02 | © 2014 OSInet FIG: gouvernance ● Formalis e, publiqueé ● https://github.com/php-fig/fig-standards/tree/master/bylaws ● Adh sion: «sponsor»é ● PSR: ● discussions ouvertes ● vote ferm de longue dur eé é ● exemple: le retrait de PSR-4
  14. 14. 14/37 | PHP_FIG-14D02 | © 2014 OSInet FIG: ressources ● Mailing-list: ● https://groups.google.com/forum/#!forum/php-fig ● http://news.php.net/php.standards (historique) ● Sites: ● http://www.php-fig.org/ ● https://github.com/php-fig/fig-standards ● IRC: ● Freenode #phpfig
  15. 15. 15/37 | PHP_FIG-14D02 | © 2014 OSInet Le PHP-FIG Les PSR en vigueur Les PSR en cours Les autres PSR
  16. 16. 16/37 | PHP_FIG-14D02 | © 2014 OSInet PSR: publi esé ● PSR-0: autoloader historique ● PSR-1: conventions utiles ● PSR-2: conventions futiles ● PSR-3: logger ● PSR-4: autoloader orient packageé
  17. 17. 17/37 | PHP_FIG-14D02 | © 2014 OSInet Le PHP-FIG Les PSR en vigueur Les PSR en cours Les autres PSR
  18. 18. 18/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-0: probl me sansè ● le probl meè ● gestion des inclusions ● limitations d'_autoload() spl_autoload_register()→ ● que mettre dans la stack de spl_autoload_register() ● les principales solutions ● mapping (registry): cf Drupal 6/7, Phing ● name path→ – complet: PSR-0 – par package: PSR-4
  19. 19. 19/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-0: sp c. en brefé ● VendorNameSpaceSymbol ● vendor/name/space/symbol ● PEAR-compatible pour PHP < 5.3 ● FooBar_Baz_Quux ● 1 symbole par fichier ● Extension .php
  20. 20. 20/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-0: probl mes avecè ● Longs chemins r p titifsé é ● Exemple Drupal 8 pre-PSR4: ● DrupalbookPluginBlockBookNavigationBlock ● (drupal)/core/modules/book/lib/Drupal/book/Plugin /Block/BookNavigationBlock.php ● Nombre de fichiers: exceptions ● 1 fichier par classe d'exception, 0 ligne de code ● traitement des retours et exceptions
  21. 21. 21/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-0: Composer ● Composer ● Est conforme PSR-0 ● Est plus efficace que l'exemple standard ● Supporte aussi l'autoload par mapping ● Composer + Packagist ● La «killer app» qui a modernis et relanc PHPé é ● Prise de conscience de l'int r t de PSR-0é ê
  22. 22. 22/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-1: basic coding ● Requiert PSR-0 (meta) PSR-4:→ ● Format fichiers ● UTF-8 sans BOM ● Tags <?php et <?=, rien d'autre ● Symboles OU effets de bord ● Un (tout petit) peu de style
  23. 23. 23/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-2: coding style ● Requiert PSR-1 ● Format du code: ● visibilit sp cifi e obligatoireé é é ● switch case sans break autoris , commentaire requisé ● h ritage du pseudo-prot g par «_», d conseillé é é é é ● abstract|final <visibility> static ● 1 instruction/ligne, minuscules, 1 use par import ● multilignes: d finition/appel fonctionsé
  24. 24. 24/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-2: coding style (2/2) ● Format de l'espace blanc ● fins de lignes LF, pas d'espaces avant ● LF terminal de fichier ● absence de ?> de fin ● indentation 4 SP, longueur lignes 80/120, bracing K&R ● lignes vierges minimales, extra autoris sé ● Non sp cifié é ● d clarations, alignement, commentairesé ● nommages, bonnes pratiques
  25. 25. 25/37 | PHP_FIG-14D02 | © 2014 OSInet Interm de: PSR-1/2è
  26. 26. 26/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-3: logging ● Pour tous: RFC5424 (syslog) ● LogLevel: les niveaux ● LoggerInterface: 1 m thode/niveau + logé ● log($level, $message, $context) ● exception sur niveau invalide ● messsage: – support au moins de string et object::__toString() – pas de moyen de le faire savoir aux clients ● les{Place.holders} {_sONt} {4utor1s3s}, ASCII only
  27. 27. 27/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-3: logging ● tableau $context ● valeurs des placeholders ● l'impl mentation doit tout accepter sauf des exceptionsé ● sauf dans la clef 'exception', qui peut aussi contenir autre chose ● en pr sence d'erreurs/inconnu:é – pas de throw – pas d'erreur ● utilisation des m thodes:é ● toujours passer les param tres, ne pas substituerè ● cf Drupal watchdog()
  28. 28. 28/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-3: pour les loggers ● AbstractLogger ● Les 8 m thodes, invoque log()é ● LoggerTrait ● ne dispense pas de d clarer l'interfaceé ● … un trait n'expose pas l'interface qu'il impl menteé
  29. 29. 29/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-3: pour les frameworks ● NullLogger ● Pour taire le logger sans avoir testerà ● Pas forc ment une bonne id e: co t du contexteé é û ● LoggerAwareInterface ● Pour la Setter Injection ● LoggerAwareTrait ● impl mente LoggerAwareInterfaceé ● inclut une prior t $loggeré é
  30. 30. 30/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-4: package autoloader ● Comme PSR-0, mais ● d marre un point de base du namespaceé à ● VendorNameSpaceSymbol ● space/symbol ● Les «_» n'ont plus de signification ● Casse libre, mais significative ● Throw, erreur et retour de chargeur interdits – classe non trouv e == erreur d'ex cution du chargeuré é
  31. 31. 31/37 | PHP_FIG-14D02 | © 2014 OSInet PSR-4: le ons de PSR-0ç ● Soutien des filesystems non UNIX ● Z ro codeé ● Trop souvent utilis comme version de r f renceé é é ● Compatibilit Composer PSR-0 et 4é ● http://blog.riff.org/2014_01_04_psr4_really ● R trofit PSR-1: meta-documentsé
  32. 32. 32/37 | PHP_FIG-14D02 | © 2014 OSInet Le PHP-FIG Les PSR en vigueur Les PSR en cours Les autres projets
  33. 33. 33/37 | PHP_FIG-14D02 | © 2014 OSInet Autre: PSR en cours ● PSR en cours: ● PSR-5 PHPdoc ● PSR-6 Cache – en discussion depuis 02/2012 – minimaliste, mais d saccord sur des bases comme TTL, clear()é – split base + extensions (CAS, inc...) ● HTTP – Client, depuis 03/2012, ne parvient pas passerà – Message, reboot en 01/2014
  34. 34. 34/37 | PHP_FIG-14D02 | © 2014 OSInet Autre: projets rejet sé ● AOP ● Coding style++ ● Form ● DB abstraction ● Collections ● EventDispatcher ● GoPHP55 ● error_handler ● interpolation ● PSR-R (location) ● PSR-X (PSR-R loader) ● PSR-8 Mutually Assured Hug
  35. 35. 35/37 | PHP_FIG-14D02 | © 2014 OSInet Autre: container_interop ● Standardiser les DIC ● Difficile ● int r t peu partagé ê é ● mais intense: initiative s par eé é ● Derni rement relanc par...è é ● David N grier :-)é
  36. 36. 36/37 | PHP_FIG-14D02 | © 2014 OSInet Questions ?
  37. 37. 37/37 | PHP_FIG-14D02 | © 2014 OSInet Drupal, faster http://www.osinet.fr/

×