SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
The state of
your own
hypertext processor
             Alessandro Nadalin

                27/03/2012
What we had
PEAR / PECL
What we have
What you should
    look at
XHPROF
 https://github.com/facebook/xhprof
Traits
http://php.net/manual/en/language.oop5.traits.php
trait XmlConversion {
    public function toXml() {
      $xml = new SimpleXMLElement('<object></object>');

        foreach($this->getXmlAttributes() as $attribute) {
          $xml->addChild(new ...)
        }

        return $xml->asXml();
    }

    abstract protected function getXmlAttributes();
}

class Person {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

class Log {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

$user = new Person();
$user->toXml();
$log = new Log();
$log->toXml();
trait XmlConversion {
    public function toXml() {
      $xml = new SimpleXMLElement('<object></object>');

        foreach($this->getXmlAttributes() as $attribute) {
          $xml->addChild(new ...)
        }

        return $xml->asXml();
    }

    abstract protected function getXmlAttributes();
}

class Person {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

class Log {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

$user = new Person();
$user->toXml();
$log = new Log();
$log->toXml();
trait XmlConversion {
    public function toXml() {
      $xml = new SimpleXMLElement('<object></object>');

        foreach($this->getXmlAttributes() as $attribute) {
          $xml->addChild(new ...)
        }

        return $xml->asXml();
    }

    abstract protected function getXmlAttributes();
}

class Person {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

class Log {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

$user = new Person();
$user->toXml();
$log = new Log();
$log->toXml();
trait XmlConversion {
    public function toXml() {
      $xml = new SimpleXMLElement('<object></object>');

        foreach($this->getXmlAttributes() as $attribute) {
          $xml->addChild(new ...)
        }

        return $xml->asXml();
    }

    abstract protected function getXmlAttributes();
}

class Person {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

class Log {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

$user = new Person();
$user->toXml();
$log = new Log();
$log->toXml();
trait XmlConversion {
    public function toXml() {
      $xml = new SimpleXMLElement('<object></object>');

        foreach($this->getXmlAttributes() as $attribute) {
          $xml->addChild(new ...)
        }

        return $xml->asXml();
    }

    abstract protected function getXmlAttributes();
}

class Person {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

class Log {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

$user = new Person();
$user->toXml();
$log = new Log();
$log->toXml();
trait XmlConversion {
    public function toXml() {
      $xml = new SimpleXMLElement('<object></object>');

        foreach($this->getXmlAttributes() as $attribute) {
          $xml->addChild(new ...)
        }

        return $xml->asXml();
    }

    abstract protected function getXmlAttributes();
}

class Person {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

class Log {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

$user = new Person();
$user->toXml();
$log = new Log();
$log->toXml();
trait XmlConversion {
    public function toXml() {
      $xml = new SimpleXMLElement('<object></object>');

        foreach($this->getXmlAttributes() as $attribute) {
          $xml->addChild(new ...)
        }

        return $xml->asXml();
    }

    abstract protected function getXmlAttributes();
}

class Person {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

class Log {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

$user = new Person();
$user->toXml();
$log = new Log();
$log->toXml();
trait XmlConversion {
    public function toXml() {
      $xml = new SimpleXMLElement('<object></object>');

        foreach($this->getXmlAttributes() as $attribute) {
          $xml->addChild(new ...)
        }

        return $xml->asXml();
    }

    abstract protected function getXmlAttributes();
}

class Person {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

class Log {
    use XmlConversion;

    protected function getXmlAttributes() {
      return ...
    }
}

$user = new Person();
$user->toXml();
$log = new Log();
$log->toXml();
SPDY
http://dev.chromium.org/spdy/spdy-whitepaper
PHP application server
        http://www.photon-project.com/
HInclude
 http://mnot.github.com/hinclude/
<hx:include src="/footer.html"></hx:include>
<hx:include src="/footer.html"></hx:include>
<hx:include src="/footer.html"></hx:include>
Composer
  http://packagist.org/
{
    "name": "robowhois/Robowhois",
    "type": "library",
    "description": "PHP SDK for Robowhois APIs.",
    "keywords": ["robowhois"],
    "license": "MIT",
    "authors": [
        {
            "name": "Alessandro Nadalin",
            "email": "alessandro.nadalin@gmail.com",
            "homepage": "http://www.odino.org"
        },
        {
            "name": "David Funaro",
            "email": "ing.davidino@gmail.com",
            "homepage": "http://davidfunaro.com"
        }
    ],
    "autoload": {
        "psr-0": {
            "Robowhois": "src/"
        }
    },
    "require": {
        "php": ">=5.3.2",
        "kriswallsmith/Buzz": "v0.5",
        "symfony/http-foundation": "v2.0.12"
    }
}
{
    "name": "robowhois/Robowhois",
    "type": "library",
    "description": "PHP SDK for Robowhois APIs.",
    "keywords": ["robowhois"],
    "license": "MIT",
    "authors": [
        {
            "name": "Alessandro Nadalin",
            "email": "alessandro.nadalin@gmail.com",
            "homepage": "http://www.odino.org"
        },
        {
            "name": "David Funaro",
            "email": "ing.davidino@gmail.com",
            "homepage": "http://davidfunaro.com"
        }
    ],
    "autoload": {
        "psr-0": {
            "Robowhois": "src/"
        }
    },
    "require": {
        "php": ">=5.3.2",
        "kriswallsmith/Buzz": "v0.5",
        "symfony/http-foundation": "v2.0.12"
    }
}
{
    "name": "robowhois/Robowhois",
    "type": "library",
    "description": "PHP SDK for Robowhois APIs.",
    "keywords": ["robowhois"],
    "license": "MIT",
    "authors": [
        {
            "name": "Alessandro Nadalin",
            "email": "alessandro.nadalin@gmail.com",
            "homepage": "http://www.odino.org"
        },
        {
            "name": "David Funaro",
            "email": "ing.davidino@gmail.com",
            "homepage": "http://davidfunaro.com"
        }
    ],
    "autoload": {
        "psr-0": {
            "Robowhois": "src/"
        }
    },
    "require": {
        "php": ">=5.3.2",
        "kriswallsmith/Buzz": "v0.5",
        "symfony/http-foundation": "v2.0.12"
    }
}
{
    "name": "robowhois/Robowhois",
    "type": "library",
    "description": "PHP SDK for Robowhois APIs.",
    "keywords": ["robowhois"],
    "license": "MIT",
    "authors": [
        {
            "name": "Alessandro Nadalin",
            "email": "alessandro.nadalin@gmail.com",
            "homepage": "http://www.odino.org"
        },
        {
            "name": "David Funaro",
            "email": "ing.davidino@gmail.com",
            "homepage": "http://davidfunaro.com"
        }
    ],
    "autoload": {
        "psr-0": {
            "Robowhois": "src/"
        }
    },
    "require": {
        "php": ">=5.3.2",
        "kriswallsmith/Buzz": "v0.5",
        "symfony/http-foundation": "v2.0.12"
    }
}
wget http://getcomposer.org/composer.
phar

php composer.phar install
wget http://getcomposer.org/composer.
phar

php composer.phar install
wget http://getcomposer.org/composer.
phar

php composer.phar install
Interoperability
    https://github.com/php-fig/fig-standards
The new exec()
    https://github.com/symfony/Process
<?php

require __DIR__ . '/vendor/.composer/autoload.php';

use SymfonyComponentProcessProcess;

$file = sys_get_temp_dir() . '/test.output.txt';

$handle   = fopen($file, 'w+');
$process = new Process('phpunit -c /home/foor/bar/phpunit.xml
/home/foo/bar');
$process->run(function ($type, $buffer) use($handle) {
  fwrite($handle, nl2br($buffer));
});

fclose($handle);
<?php

require __DIR__ . '/vendor/.composer/autoload.php';

use SymfonyComponentProcessProcess;

$file = sys_get_temp_dir() . '/test.output.txt';

$handle   = fopen($file, 'w+');
$process = new Process('phpunit -c /home/foor/bar/phpunit.xml
/home/foo/bar');
$process->run(function ($type, $buffer) use($handle) {
  fwrite($handle, nl2br($buffer));
});

fclose($handle);
<?php

require __DIR__ . '/vendor/.composer/autoload.php';

use SymfonyComponentProcessProcess;

$file = sys_get_temp_dir() . '/test.output.txt';

$handle   = fopen($file, 'w+');
$process = new Process('phpunit -c /home/foor/bar/phpunit.xml
/home/foo/bar');
$process->run(function ($type, $buffer) use($handle) {
  fwrite($handle, nl2br($buffer));
});

fclose($handle);
<?php

require __DIR__ . '/vendor/.composer/autoload.php';

use SymfonyComponentProcessProcess;

$file = sys_get_temp_dir() . '/test.output.txt';

$handle   = fopen($file, 'w+');
$process = new Process('phpunit -c /home/foor/bar/phpunit.xml
/home/foo/bar');
$process->run(function ($type, $buffer) use($handle) {
  fwrite($handle, nl2br($buffer));
});

fclose($handle);
A "new" simple SAPI
      https://github.com/symfony/Console
<?php

use   SymfonyComponentConsoleCommandCommand;
use   SymfonyComponentConsoleOutputOutputInterface;
use   SymfonyComponentConsoleInputInputInterface;
use   SymfonyComponentProcessProcess;

class Install   extends Command
{
    protected   $installDir;
    protected   $failingProcess;
    protected   $dependenciesContainer;

      public function __construct(DependencyContainer $dependenciesContainer)
      {
          parent::__construct();

          $this->dependenciesContainer = $dependenciesContainer;
      }

      protected function execute(InputInterface $input, OutputInterface $output)
      {
          if ($this->createInstallationDirectory($output)
           && $this->downloadComposer($output)
           && $this->generateJson($output)
           && $this->install($output)) {
              $output->writeln('<info>MISSION ACCOMPLISHED</info>');
          } else {
              $output->writeln('<error>Nasty error happened :'-(</error>');

              if ($this->failingProcess instanceOf Process) {
                  $output->writeln('<error>%s</error>', $this->failingProcess->getErrorOutput());
              }
          }
      }

      protected function configure()
      {
          $this
              ->setName('install')
          ;
      }
}
‫وداﻋﺎ وداﻋﺎ‬

Weitere ähnliche Inhalte

Was ist angesagt?

Backbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserBackbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserHoward Lewis Ship
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony TechniquesKris Wallsmith
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous phpWim Godden
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsMark Baker
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensionserwanl
 
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Kris Wallsmith
 
Testing Web Applications with GEB
Testing Web Applications with GEBTesting Web Applications with GEB
Testing Web Applications with GEBHoward Lewis Ship
 
Backbone js
Backbone jsBackbone js
Backbone jsrstankov
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to NodejsGabriele Lana
 
Ruby/Rails
Ruby/RailsRuby/Rails
Ruby/Railsrstankov
 
Decoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DICDecoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DICKonstantin Kudryashov
 
5 Tips for Better JavaScript
5 Tips for Better JavaScript5 Tips for Better JavaScript
5 Tips for Better JavaScriptTodd Anglin
 
Models and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and HobgoblinsModels and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and HobgoblinsRoss Tuck
 
PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)Nikita Popov
 

Was ist angesagt? (20)

Backbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserBackbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The Browser
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous php
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensions
 
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)
 
Testing Web Applications with GEB
Testing Web Applications with GEBTesting Web Applications with GEB
Testing Web Applications with GEB
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to Nodejs
 
Your code is not a string
Your code is not a stringYour code is not a string
Your code is not a string
 
Why ruby
Why rubyWhy ruby
Why ruby
 
Ruby/Rails
Ruby/RailsRuby/Rails
Ruby/Rails
 
ES6 is Nigh
ES6 is NighES6 is Nigh
ES6 is Nigh
 
Decoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DICDecoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DIC
 
Nubilus Perl
Nubilus PerlNubilus Perl
Nubilus Perl
 
5 Tips for Better JavaScript
5 Tips for Better JavaScript5 Tips for Better JavaScript
5 Tips for Better JavaScript
 
Models and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and HobgoblinsModels and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and Hobgoblins
 
JavaScript ES6
JavaScript ES6JavaScript ES6
JavaScript ES6
 
PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)
 
Perl Web Client
Perl Web ClientPerl Web Client
Perl Web Client
 

Ähnlich wie The state of your own hypertext preprocessor

Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologyDaniel Knell
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Tsuyoshi Yamamoto
 
Multilingualism makes better programmers
Multilingualism makes better programmersMultilingualism makes better programmers
Multilingualism makes better programmersAlexander Varwijk
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony AppsKris Wallsmith
 
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Mail.ru Group
 
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Mail.ru Group
 
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014Puppet
 
News of the Symfony2 World
News of the Symfony2 WorldNews of the Symfony2 World
News of the Symfony2 WorldFabien Potencier
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Hugo Hamon
 
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)James Titcumb
 
Code generation for alternative languages
Code generation for alternative languagesCode generation for alternative languages
Code generation for alternative languagesRafael Winterhalter
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5arajivmordani
 

Ähnlich wie The state of your own hypertext preprocessor (20)

Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technology
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
Multilingualism makes better programmers
Multilingualism makes better programmersMultilingualism makes better programmers
Multilingualism makes better programmers
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
 
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
 
Symfony2 revealed
Symfony2 revealedSymfony2 revealed
Symfony2 revealed
 
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
 
News of the Symfony2 World
News of the Symfony2 WorldNews of the Symfony2 World
News of the Symfony2 World
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2
 
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
 
Code generation for alternative languages
Code generation for alternative languagesCode generation for alternative languages
Code generation for alternative languages
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
DevOps with Fabric
DevOps with FabricDevOps with Fabric
DevOps with Fabric
 
Doctrine and NoSQL
Doctrine and NoSQLDoctrine and NoSQL
Doctrine and NoSQL
 
Migrare da symfony 1 a Symfony2
 Migrare da symfony 1 a Symfony2  Migrare da symfony 1 a Symfony2
Migrare da symfony 1 a Symfony2
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 

Mehr von Alessandro Nadalin

Spa, isomorphic and back to the server our journey with js @ frontend con po...
Spa, isomorphic and back to the server  our journey with js @ frontend con po...Spa, isomorphic and back to the server  our journey with js @ frontend con po...
Spa, isomorphic and back to the server our journey with js @ frontend con po...Alessandro Nadalin
 
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...Alessandro Nadalin
 
Scaling at Namshi @ Seamless Ecommerce Dubai 2017
Scaling at Namshi @ Seamless Ecommerce Dubai 2017Scaling at Namshi @ Seamless Ecommerce Dubai 2017
Scaling at Namshi @ Seamless Ecommerce Dubai 2017Alessandro Nadalin
 
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in Dubai
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in DubaiAccelerated Mobile Pages @ Dubytes meetup Dec 2016 in Dubai
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in DubaiAlessandro Nadalin
 
A tech team of ~10 @ Rocket Tech Summit 2016 in Berlin
A tech team of ~10 @ Rocket Tech Summit 2016 in BerlinA tech team of ~10 @ Rocket Tech Summit 2016 in Berlin
A tech team of ~10 @ Rocket Tech Summit 2016 in BerlinAlessandro Nadalin
 
React native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeReact native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeAlessandro Nadalin
 
Dockerize it! @ Codemotion 2016 in Rome
Dockerize it! @ Codemotion 2016 in RomeDockerize it! @ Codemotion 2016 in Rome
Dockerize it! @ Codemotion 2016 in RomeAlessandro Nadalin
 
Deploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
Deploying 3 times a day without a downtime @ Rocket Tech Summit in BerlinDeploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
Deploying 3 times a day without a downtime @ Rocket Tech Summit in BerlinAlessandro Nadalin
 
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...Alessandro Nadalin
 
Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)
Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)
Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)Alessandro Nadalin
 
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)Alessandro Nadalin
 
OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...
OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...
OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...Alessandro Nadalin
 
A Rocket Internet experience @ ForumPHP Paris 2013
A Rocket Internet experience @ ForumPHP Paris 2013A Rocket Internet experience @ ForumPHP Paris 2013
A Rocket Internet experience @ ForumPHP Paris 2013Alessandro Nadalin
 
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San FranciscoHTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San FranciscoAlessandro Nadalin
 
Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...
Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...
Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...Alessandro Nadalin
 
The rocket internet experience @ PHP.TO.START 2013 in Turin
The rocket internet experience @ PHP.TO.START 2013 in TurinThe rocket internet experience @ PHP.TO.START 2013 in Turin
The rocket internet experience @ PHP.TO.START 2013 in TurinAlessandro Nadalin
 
GraphDB in PHP @ Codemotion 03/23/2012
GraphDB in PHP @ Codemotion 03/23/2012GraphDB in PHP @ Codemotion 03/23/2012
GraphDB in PHP @ Codemotion 03/23/2012Alessandro Nadalin
 
REST in peace @ IPC 2012 in Mainz
REST in peace @ IPC 2012 in MainzREST in peace @ IPC 2012 in Mainz
REST in peace @ IPC 2012 in MainzAlessandro Nadalin
 
HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?Alessandro Nadalin
 

Mehr von Alessandro Nadalin (20)

Spa, isomorphic and back to the server our journey with js @ frontend con po...
Spa, isomorphic and back to the server  our journey with js @ frontend con po...Spa, isomorphic and back to the server  our journey with js @ frontend con po...
Spa, isomorphic and back to the server our journey with js @ frontend con po...
 
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
 
Scaling at Namshi @ Seamless Ecommerce Dubai 2017
Scaling at Namshi @ Seamless Ecommerce Dubai 2017Scaling at Namshi @ Seamless Ecommerce Dubai 2017
Scaling at Namshi @ Seamless Ecommerce Dubai 2017
 
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in Dubai
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in DubaiAccelerated Mobile Pages @ Dubytes meetup Dec 2016 in Dubai
Accelerated Mobile Pages @ Dubytes meetup Dec 2016 in Dubai
 
A tech team of ~10 @ Rocket Tech Summit 2016 in Berlin
A tech team of ~10 @ Rocket Tech Summit 2016 in BerlinA tech team of ~10 @ Rocket Tech Summit 2016 in Berlin
A tech team of ~10 @ Rocket Tech Summit 2016 in Berlin
 
React native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeReact native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in Rome
 
Dockerize it! @ Codemotion 2016 in Rome
Dockerize it! @ Codemotion 2016 in RomeDockerize it! @ Codemotion 2016 in Rome
Dockerize it! @ Codemotion 2016 in Rome
 
Deploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
Deploying 3 times a day without a downtime @ Rocket Tech Summit in BerlinDeploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
Deploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
 
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
 
Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)
Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)
Don't screw it up: how to build durable web apis @ PHPDay 2014 in Verona (ITA)
 
Namshi in 2014: let's rock!
Namshi in 2014: let's rock!Namshi in 2014: let's rock!
Namshi in 2014: let's rock!
 
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
 
OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...
OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...
OrientDB, the fastest document-based graph database @ Confoo 2014 in Montreal...
 
A Rocket Internet experience @ ForumPHP Paris 2013
A Rocket Internet experience @ ForumPHP Paris 2013A Rocket Internet experience @ ForumPHP Paris 2013
A Rocket Internet experience @ ForumPHP Paris 2013
 
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San FranciscoHTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco
 
Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...
Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...
Tips and Tricks for your Service Oriented Architecture @ CakeFest 2013 in San...
 
The rocket internet experience @ PHP.TO.START 2013 in Turin
The rocket internet experience @ PHP.TO.START 2013 in TurinThe rocket internet experience @ PHP.TO.START 2013 in Turin
The rocket internet experience @ PHP.TO.START 2013 in Turin
 
GraphDB in PHP @ Codemotion 03/23/2012
GraphDB in PHP @ Codemotion 03/23/2012GraphDB in PHP @ Codemotion 03/23/2012
GraphDB in PHP @ Codemotion 03/23/2012
 
REST in peace @ IPC 2012 in Mainz
REST in peace @ IPC 2012 in MainzREST in peace @ IPC 2012 in Mainz
REST in peace @ IPC 2012 in Mainz
 
HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?
 

Kürzlich hochgeladen

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 

The state of your own hypertext preprocessor

  • 1. The state of your own hypertext processor Alessandro Nadalin 27/03/2012
  • 3.
  • 5.
  • 6.
  • 7.
  • 9.
  • 10.
  • 11.
  • 12. What you should look at
  • 15. trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes(); } class Person { use XmlConversion; protected function getXmlAttributes() { return ... } } class Log { use XmlConversion; protected function getXmlAttributes() { return ... } } $user = new Person(); $user->toXml(); $log = new Log(); $log->toXml();
  • 16. trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes(); } class Person { use XmlConversion; protected function getXmlAttributes() { return ... } } class Log { use XmlConversion; protected function getXmlAttributes() { return ... } } $user = new Person(); $user->toXml(); $log = new Log(); $log->toXml();
  • 17. trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes(); } class Person { use XmlConversion; protected function getXmlAttributes() { return ... } } class Log { use XmlConversion; protected function getXmlAttributes() { return ... } } $user = new Person(); $user->toXml(); $log = new Log(); $log->toXml();
  • 18. trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes(); } class Person { use XmlConversion; protected function getXmlAttributes() { return ... } } class Log { use XmlConversion; protected function getXmlAttributes() { return ... } } $user = new Person(); $user->toXml(); $log = new Log(); $log->toXml();
  • 19. trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes(); } class Person { use XmlConversion; protected function getXmlAttributes() { return ... } } class Log { use XmlConversion; protected function getXmlAttributes() { return ... } } $user = new Person(); $user->toXml(); $log = new Log(); $log->toXml();
  • 20. trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes(); } class Person { use XmlConversion; protected function getXmlAttributes() { return ... } } class Log { use XmlConversion; protected function getXmlAttributes() { return ... } } $user = new Person(); $user->toXml(); $log = new Log(); $log->toXml();
  • 21. trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes(); } class Person { use XmlConversion; protected function getXmlAttributes() { return ... } } class Log { use XmlConversion; protected function getXmlAttributes() { return ... } } $user = new Person(); $user->toXml(); $log = new Log(); $log->toXml();
  • 22. trait XmlConversion { public function toXml() { $xml = new SimpleXMLElement('<object></object>'); foreach($this->getXmlAttributes() as $attribute) { $xml->addChild(new ...) } return $xml->asXml(); } abstract protected function getXmlAttributes(); } class Person { use XmlConversion; protected function getXmlAttributes() { return ... } } class Log { use XmlConversion; protected function getXmlAttributes() { return ... } } $user = new Person(); $user->toXml(); $log = new Log(); $log->toXml();
  • 24. PHP application server http://www.photon-project.com/
  • 30. { "name": "robowhois/Robowhois", "type": "library", "description": "PHP SDK for Robowhois APIs.", "keywords": ["robowhois"], "license": "MIT", "authors": [ { "name": "Alessandro Nadalin", "email": "alessandro.nadalin@gmail.com", "homepage": "http://www.odino.org" }, { "name": "David Funaro", "email": "ing.davidino@gmail.com", "homepage": "http://davidfunaro.com" } ], "autoload": { "psr-0": { "Robowhois": "src/" } }, "require": { "php": ">=5.3.2", "kriswallsmith/Buzz": "v0.5", "symfony/http-foundation": "v2.0.12" } }
  • 31. { "name": "robowhois/Robowhois", "type": "library", "description": "PHP SDK for Robowhois APIs.", "keywords": ["robowhois"], "license": "MIT", "authors": [ { "name": "Alessandro Nadalin", "email": "alessandro.nadalin@gmail.com", "homepage": "http://www.odino.org" }, { "name": "David Funaro", "email": "ing.davidino@gmail.com", "homepage": "http://davidfunaro.com" } ], "autoload": { "psr-0": { "Robowhois": "src/" } }, "require": { "php": ">=5.3.2", "kriswallsmith/Buzz": "v0.5", "symfony/http-foundation": "v2.0.12" } }
  • 32. { "name": "robowhois/Robowhois", "type": "library", "description": "PHP SDK for Robowhois APIs.", "keywords": ["robowhois"], "license": "MIT", "authors": [ { "name": "Alessandro Nadalin", "email": "alessandro.nadalin@gmail.com", "homepage": "http://www.odino.org" }, { "name": "David Funaro", "email": "ing.davidino@gmail.com", "homepage": "http://davidfunaro.com" } ], "autoload": { "psr-0": { "Robowhois": "src/" } }, "require": { "php": ">=5.3.2", "kriswallsmith/Buzz": "v0.5", "symfony/http-foundation": "v2.0.12" } }
  • 33. { "name": "robowhois/Robowhois", "type": "library", "description": "PHP SDK for Robowhois APIs.", "keywords": ["robowhois"], "license": "MIT", "authors": [ { "name": "Alessandro Nadalin", "email": "alessandro.nadalin@gmail.com", "homepage": "http://www.odino.org" }, { "name": "David Funaro", "email": "ing.davidino@gmail.com", "homepage": "http://davidfunaro.com" } ], "autoload": { "psr-0": { "Robowhois": "src/" } }, "require": { "php": ">=5.3.2", "kriswallsmith/Buzz": "v0.5", "symfony/http-foundation": "v2.0.12" } }
  • 37. Interoperability https://github.com/php-fig/fig-standards
  • 38. The new exec() https://github.com/symfony/Process
  • 39. <?php require __DIR__ . '/vendor/.composer/autoload.php'; use SymfonyComponentProcessProcess; $file = sys_get_temp_dir() . '/test.output.txt'; $handle = fopen($file, 'w+'); $process = new Process('phpunit -c /home/foor/bar/phpunit.xml /home/foo/bar'); $process->run(function ($type, $buffer) use($handle) { fwrite($handle, nl2br($buffer)); }); fclose($handle);
  • 40. <?php require __DIR__ . '/vendor/.composer/autoload.php'; use SymfonyComponentProcessProcess; $file = sys_get_temp_dir() . '/test.output.txt'; $handle = fopen($file, 'w+'); $process = new Process('phpunit -c /home/foor/bar/phpunit.xml /home/foo/bar'); $process->run(function ($type, $buffer) use($handle) { fwrite($handle, nl2br($buffer)); }); fclose($handle);
  • 41. <?php require __DIR__ . '/vendor/.composer/autoload.php'; use SymfonyComponentProcessProcess; $file = sys_get_temp_dir() . '/test.output.txt'; $handle = fopen($file, 'w+'); $process = new Process('phpunit -c /home/foor/bar/phpunit.xml /home/foo/bar'); $process->run(function ($type, $buffer) use($handle) { fwrite($handle, nl2br($buffer)); }); fclose($handle);
  • 42. <?php require __DIR__ . '/vendor/.composer/autoload.php'; use SymfonyComponentProcessProcess; $file = sys_get_temp_dir() . '/test.output.txt'; $handle = fopen($file, 'w+'); $process = new Process('phpunit -c /home/foor/bar/phpunit.xml /home/foo/bar'); $process->run(function ($type, $buffer) use($handle) { fwrite($handle, nl2br($buffer)); }); fclose($handle);
  • 43. A "new" simple SAPI https://github.com/symfony/Console
  • 44. <?php use SymfonyComponentConsoleCommandCommand; use SymfonyComponentConsoleOutputOutputInterface; use SymfonyComponentConsoleInputInputInterface; use SymfonyComponentProcessProcess; class Install extends Command { protected $installDir; protected $failingProcess; protected $dependenciesContainer; public function __construct(DependencyContainer $dependenciesContainer) { parent::__construct(); $this->dependenciesContainer = $dependenciesContainer; } protected function execute(InputInterface $input, OutputInterface $output) { if ($this->createInstallationDirectory($output) && $this->downloadComposer($output) && $this->generateJson($output) && $this->install($output)) { $output->writeln('<info>MISSION ACCOMPLISHED</info>'); } else { $output->writeln('<error>Nasty error happened :'-(</error>'); if ($this->failingProcess instanceOf Process) { $output->writeln('<error>%s</error>', $this->failingProcess->getErrorOutput()); } } } protected function configure() { $this ->setName('install') ; } }