SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
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')
          ;
      }
}
‫وداﻋﺎ وداﻋﺎ‬

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Mail.ru Group
 
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...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
 

Similaire à 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 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
 
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
 
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
 

Plus de 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
 

Plus de 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?
 

Dernier

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Dernier (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

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