Outside The Bubble

Outside The Bubble

What happened outside of the WordPress community in the PHP community at large

Eba4cc68bfbc2b59c3c3a3cf789075f0?s=128

Tom J Nowell

July 14, 2013
Tweet

Transcript

  1. Outside The Bubble A WordCamp talk by Tom J Nowell

  2. Who Am I?

  3. Defining The Bubble

  4. What's Happening Inside?

  5. What Happened Outside?

  6. PHP 5.3, 5.4, & 5.5

  7. Massive Performance Increases PHP 5.3 significantly faster than 5.2 PHP

    5.4 up to 2x as fast in some benchmarks No code changes required
  8. PSR-0 PSR-1 and PSR-2 Standards for PHP code: • Standard

    code style • Standard auto loaders & class conventions • Standard logger interfaces • Amongst others..
  9. Namespaces Lambdas Closures Traits Generators Queues DoubleLinkedLists Heaps Stacks etc

    and more
  10. Namespaces

  11. Lambdas & Closures // Lambdas add_action( 'the_content', function( $content ){

    return $content.'Final Note'; }); // Closures $note = 'Final Note'; add_action( 'the_content', function($content) use($note) { return $content.$note; }); // anonymous functions $func = function( $content ) { return $content.'the end'; }; add_action( 'the_content', $func );
  12. Traits Requires PHP 5.4

  13. Speaking of Singletons...

  14. Generators

  15. Queues, Stacks, Sets, PriorityQueues, Heaps & other SPL containers Special

    containers with performance and memory advantages over standard arrays
  16. None
  17. MySQL Removed

  18. Replaced by PDO, MySQLi & ORMs e.g. Doctrine, Idiorm etc

    WordPress hasn't moved to support these and breaks in PHP 5.5
  19. QA Tools

  20. PHPLOC

  21. PHP CodeSniffer Prevent common semantic errors, and highlight coding standards

    violations
  22. PHP Mess Detector Takes a given PHP source code base

    and look for several potential problems within that source. These problems can be things like: • Possible bugs • Suboptimal code • Overcomplicated expressions • Unused parameters, methods, properties
  23. SCheck & Facebook PHP tools • Catch common mistakes such

    as: function add_hash( $color ) { return '#'.$colour; } addhash(); // missing '_' • Generate databases describing your code structure for analysis • View codebases in visual tools with Google Maps style panning and zoom, and search for functions and objects
  24. phantm Static analyser to check type in PHP code amongst

    other things $dict = array(); $dict['en'] = array(); $dict['en']['fr'] = 'Bonjour'; $dict['en']['de'] = 'Hallo'; $dist['en']['it'] = 'Ciao'; $dict['en']['sp'] = 'Hola'; <input>:7 Notice: Type mismatch: expected: Array[...], found: Top $dist['en']['it'] = 'Ciao';
  25. Invasion of the MVC Frameworks

  26. None
  27. None
  28. None
  29. Zend Framework

  30. None
  31. None
  32. None
  33. Goutte A web client/scraping library require_once '/path/to/goutte.phar'; use Goutte\Client; $client

    = new Client(); $crawler = $client->request( 'GET', 'http://www.symfony-project.org/' ); $link = $crawler->selectLink('Plugins')->link(); $crawler = $client->click($link); $nodes = $crawler->filter('.error_list'); if ($nodes->count()){ die(sprintf("Authentication error: %s\n", $nodes->text())); }
  34. Underscore.php

  35. Assetic Asset management on steroids • Handles all assets, js/css/images/less/sass/etc

    • Generic filter system for compilation/compression/URL handling amongst other things • Handles Caching & filesystem searches
  36. Klein Superfast URL Router Library <?php require_once __DIR__ . '/vendor/autoload.php';

    $klein = new \Klein\Klein(); $klein->respond('GET', '/hello-world', function () { return 'Hello World!'; }); $klein->dispatch();
  37. Dispatch A PHP 5.3 Micro framework <?php require('../src/dispatch.php'); config('site.router', 'index.php');

    get('/users', function () { echo "listing users..."; }); // get route for index get('/index', function () { echo "hello, world!\n"; });
  38. Twig Super fast templating engine <!DOCTYPE html> <html> <head> <title>My

    Webpage</title> </head> <body> <ul id="navigation"> {% for item in navigation %} <li><a href="{{ item.href }}">{{ item.caption }}</a></li> {% endfor %} </ul> <h1>My Webpage</h1> {{ a_variable }} </body> </html>
  39. Places To Find Out More PHPNW October, Manchester PHPUK February,

    London PHPNE April, Newcastle
  40. Questions? Tom J Nowell @tarendai contact@tomjn.com www.tomjn.com