$30 off During Our Annual Pro Sale. View Details »

Outside The Bubble

Outside The Bubble

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

Tom J Nowell

July 14, 2013
Tweet

More Decks by Tom J Nowell

Other Decks in Technology

Transcript

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

    View Slide

  2. Who Am I?

    View Slide

  3. Defining The Bubble

    View Slide

  4. What's Happening Inside?

    View Slide

  5. What Happened Outside?

    View Slide

  6. PHP 5.3, 5.4, & 5.5

    View Slide

  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

    View Slide

  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..

    View Slide

  9. Namespaces
    Lambdas
    Closures
    Traits
    Generators
    Queues DoubleLinkedLists Heaps Stacks etc
    and more

    View Slide

  10. Namespaces

    View Slide

  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 );

    View Slide

  12. Traits
    Requires PHP 5.4

    View Slide

  13. Speaking of Singletons...

    View Slide

  14. Generators

    View Slide

  15. Queues, Stacks, Sets,
    PriorityQueues, Heaps & other SPL
    containers
    Special containers with performance and
    memory advantages over standard arrays

    View Slide

  16. View Slide

  17. MySQL Removed

    View Slide

  18. Replaced by PDO, MySQLi & ORMs
    e.g. Doctrine, Idiorm etc
    WordPress hasn't moved to support these and
    breaks in PHP 5.5

    View Slide

  19. QA Tools

    View Slide

  20. PHPLOC

    View Slide

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

    View Slide

  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

    View Slide

  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

    View Slide

  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';
    :7 Notice: Type mismatch: expected: Array[...], found: Top
    $dist['en']['it'] = 'Ciao';

    View Slide

  25. Invasion of the MVC Frameworks

    View Slide

  26. View Slide

  27. View Slide

  28. View Slide

  29. Zend Framework

    View Slide

  30. View Slide

  31. View Slide

  32. View Slide

  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()));
    }

    View Slide

  34. Underscore.php

    View Slide

  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

    View Slide

  36. Klein
    Superfast URL Router Library
    require_once __DIR__ . '/vendor/autoload.php';
    $klein = new \Klein\Klein();
    $klein->respond('GET', '/hello-world', function () {
    return 'Hello World!';
    });
    $klein->dispatch();

    View Slide

  37. Dispatch
    A PHP 5.3 Micro framework
    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";
    });

    View Slide

  38. Twig
    Super fast templating engine



    My Webpage



    {% for item in navigation %}
    {{ item.caption }}
    {% endfor %}

    My Webpage
    {{ a_variable }}


    View Slide

  39. Places To Find Out More
    PHPNW
    October, Manchester
    PHPUK
    February, London
    PHPNE
    April, Newcastle

    View Slide

  40. Questions?
    Tom J Nowell
    @tarendai
    [email protected]
    www.tomjn.com

    View Slide