Php trollons-mais-trollons-bien (Bdx.io 2015)
-
Upload
arnaud-langlade -
Category
Internet
-
view
1.510 -
download
1
Transcript of Php trollons-mais-trollons-bien (Bdx.io 2015)
![Page 1: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/1.jpg)
PHP : TROLLONS, MAIS TROLLONS BIEN!
![Page 2: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/2.jpg)
QUI SUIS-JE ?Arnaud Langlade (@_aRn0D)
Développeur PHP/Symfony@CleverAge
Core team member @Sylius (et bientôt @akeneo)
![Page 3: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/3.jpg)
POURQUOI CE TALK ?!?Polo : Quel langage, utilises tu ?
Arnaud : PHP, mon polo!
Polo :
![Page 4: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/4.jpg)
OUI, EN PHP ON A VU ... (PHP4) require 'lib/function.php';
if (isset($_GET['page'])) echo "<html>"; include($_GET['page'].'.php'); echo "</html>";
class Connection var $dsn; function connection() // ...
![Page 5: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/5.jpg)
On est d'accord, ça ne donne pas envie...
![Page 6: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/6.jpg)
MAIS ÇA ÉVOLUE ! DEPUIS UN MOMENT DÉJÀ...
![Page 7: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/7.jpg)
AMÉLIORATION DU MODE OBJET (PHP5) namespace Bdd/Common;
use Bdd/Common/Connection as BaseConnection;
class Connection extends BaseConnection implements ConnectionInterface, ContainerAwareInterface use ConnectionTrait;
const TYPE = 'my_sql';
private $dsn = null; // Peut être public ou protected
public function __construct(array $config) /*...*/
final public function query(Criteria $criteria) /*...*/
![Page 8: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/8.jpg)
AMÉLIORATION DU MODE OBJET (PHP7) declare(strict_types = 1);
namespace Bdd/Common;
use Bdd/Common/Connection as BaseConnection;
class ConnectionFactory implements ConnectionFactoryInterface public function create(string $dsn) : Connection try return new Connection($dsn); catch (TypeError $e) // Une partie des erreurs Fatales sont transformées en Error echo $e>getMessage();
![Page 9: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/9.jpg)
LA DELOREAN EST EN MARCHE...Mélange procédural et d'objet (maisgros gap entre PHP4 et PHP7)L'api est très bien documentée (etinternationalisée)La core team a défini un processus derelease (RFC + Vote)Communauté vaste, expérimentée etorganisée (User group, conférence)
![Page 10: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/10.jpg)
LA COMMUNAUTÉ EST LÀ ET ELLE...
![Page 11: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/11.jpg)
LA COMMUNAUTÉLa communauté s'est bien diversifiée (il y'a de très bons développeurs)Les projets open source demandent une bonne qualité de code (design ettests)De nombreuse librairies sont disponibles ( )packagist.org
![Page 12: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/12.jpg)
PHP FRAMEWORK INTEROP GROUP (PHPFIG)Regroupe des acteurs majeurs du monde PHP (Sf, Zf, eZ, Doctrine, etc.)Parle des problématiques communes à chaque projetCréation des PHP Standard Recommendation (PSRs)
![Page 13: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/13.jpg)
LES NORMES PSR (PHP STANDARD RECOMMENDATION)PSR0 et PSR4 : Chargement des classesPSR1 et PSR2 : Style du codePSR3 : Gestion des logsPSR7 : Messages HTTP
![Page 14: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/14.jpg)
INDUSTRIALISATION DE PHPGestionnaire de dépendences :Composer/^(|micro) framework$/: Symfony,Laravel, Zend, Yii, Slim, Silex, etc...Framework de tests : PhpUnit,Atoum, Behat ou bien PhpSpec.Intégration continue:PHP_CodeSniffer,PHP_Depend/PHPMD, PHPCPD,PhpDependencyAnalysis etc...
![Page 15: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/15.jpg)
POUR FINIR
Ce n'est pas un langage quifait un développeur mais la
façon dont il l'utilise.
PHP et sa communautéévolue dans le bon sens mêmesi le langage n'est pas parfait.
![Page 16: Php trollons-mais-trollons-bien (Bdx.io 2015)](https://reader031.fdocumento.com/reader031/viewer/2022030307/58e7fa991a28abf13f8b5343/html5/thumbnails/16.jpg)
MERCI! QUESTIONS ?
Arnaud Langlade
Twiter @_aRn0D
Github @aRn0D