SlideShare una empresa de Scribd logo
1 de 47
Descargar para leer sin conexión
PHP Reset
                         Jordi Boggiano @seldaek
                              http://nelm.io/

Jordi Boggiano                                     Company http://nelm.io
http://twitter.com/seldaek                             Blog http://seld.be
Disclaimer
                             This is not about REST




Jordi Boggiano                                        Company http://nelm.io
http://twitter.com/seldaek                                Blog http://seld.be
About Me
               Belgian living in Zürich
               Weby stuff for 10 years
               http://seld.be
               Symfony2 core dev and other OSS contributions
               http://github.com/Seldaek
               Recently started Nelmio
               http://nelm.io
               We do Symfony2 & Frontend Performance consulting




Jordi Boggiano                                               Company http://nelm.io
http://twitter.com/seldaek                                       Blog http://seld.be
Planning
                       Small Rant
                       New Frameworks & Libraries
                       GitHub Commercial Break
                       Best Practices
                       Composer
                       Wishful Thinking




Jordi Boggiano                                      Company http://nelm.io
http://twitter.com/seldaek                              Blog http://seld.be
A bit of history




Jordi Boggiano                                  Company http://nelm.io
http://twitter.com/seldaek                          Blog http://seld.be
PHP4 - 22-May-2000
               01 class Foo_Bar_Baz
               02 {
               03     var $foo;
               04
               05     function Foo_Bar_Baz()
               06     {
               07     }
               08
               09     function bar()
               10     {
               11     }
               12 }




Jordi Boggiano                                             Company http://nelm.io
http://twitter.com/seldaek                                     Blog http://seld.be
PHP5 - 13-Jul-2004
               01 class Foo_Bar_Baz
               02 {
               03     public $foo;
               04
               05     public function __construct()
               06     {
               07     }
               08
               09     private function bar()
               10     {
               11     }
               12 }




Jordi Boggiano                                              Company http://nelm.io
http://twitter.com/seldaek                                      Blog http://seld.be
Could you spot the differences?




Jordi Boggiano                              Company http://nelm.io
http://twitter.com/seldaek                      Blog http://seld.be
Yet seven years later
                ~20% of servers still run PHP4




                             Source: @iliaa's PHP Advent article, December 2010.




Jordi Boggiano                                                                     Company http://nelm.io
http://twitter.com/seldaek                                                             Blog http://seld.be
PHP5.3 - 30-Jun-2009
               01   namespace FooBar;
               02
               03   class Baz
               04   {
               05       public $foo;
               06
               07            public function __construct()
               08            {
               09            }
               10
               11            private function bar()
               12            {
               13            }
               14   }




Jordi Boggiano                                                     Company http://nelm.io
http://twitter.com/seldaek                                             Blog http://seld.be
Again, not much has changed.
                   But it changes everything.
                             BackslashMeansNoBackwardsCompatibility




Jordi Boggiano                                                            Company http://nelm.io
http://twitter.com/seldaek                                                    Blog http://seld.be
We've been sitting on our asses
                          for too long.
                    It's time for a change.




Jordi Boggiano                              Company http://nelm.io
http://twitter.com/seldaek                      Blog http://seld.be
New Frameworks




Jordi Boggiano                                Company http://nelm.io
http://twitter.com/seldaek                        Blog http://seld.be
Symfony2
                              Lithium
                               Silex
                                ZF2
                                 ...
                                  .


Jordi Boggiano                          Company http://nelm.io
http://twitter.com/seldaek                  Blog http://seld.be
New Libraries




Jordi Boggiano                               Company http://nelm.io
http://twitter.com/seldaek                       Blog http://seld.be
Assetic
               Asset management & processing
                       Combine & Compress JS, CSS
                       Compile CoffeeScript, SASS, LESS, ..
                       Re-encode images
                       All on the fly with cache or pre-processed
                       Inspired by Python's WebAssets
                       Shipped with Symfony2
               http://github.com/kriswallsmith/assetic




Jordi Boggiano                                                Company http://nelm.io
http://twitter.com/seldaek                                        Blog http://seld.be
Doctrine2
               DBAL, ORM, ODMs
                       Document stores (MongoDB, CouchDB,
                       PHPCR, XML)
                       Common interfaces allow for interop and
                       knowledge re-use
                       Propel2 builds on top of it
                       Shipped with Symfony2
               http://github.com/doctrine




Jordi Boggiano                                              Company http://nelm.io
http://twitter.com/seldaek                                      Blog http://seld.be
Monolog
               Logging
                       FingersCrossedHandler for production
                       Log to files, FirePHP, emails, etc.
                       Inspired by Python's Logbook
                       Shipped with Symfony2
               http://github.com/Seldaek/monolog




Jordi Boggiano                                                Company http://nelm.io
http://twitter.com/seldaek                                        Blog http://seld.be
Twig
               Template engine
                       Automatic escaping
                       Separation of concerns
                       (Readability)
                       Inspired by Python's Jinja2
                       Shipped with Symfony2
               http://github.com/fabpot/Twig




Jordi Boggiano                                       Company http://nelm.io
http://twitter.com/seldaek                               Blog http://seld.be
Gaufrette
               Filesystem abstraction
                       Code once, store files anywhere
                       S3, Memory, FTP, Rackspace, ..
                       Transparently cache calls to slow backends
               http://github.com/knplabs/Gaufrette




Jordi Boggiano                                               Company http://nelm.io
http://twitter.com/seldaek                                       Blog http://seld.be
Snappy
               Generates PDF/images from webpages
                       Uses wkhtmltopdf/wkhtmltoimage
                       Good example of a small single-purpose
                       library
               http://github.com/knplabs/snappy




Jordi Boggiano                                              Company http://nelm.io
http://twitter.com/seldaek                                      Blog http://seld.be
Imagine
               Image manipulation
                       API that doesn't suck
                       Supports GD2, Imagick, Gmagick
                       Easily resize, crop, and more
                       Inspired by Python's PIL & others
               http://github.com/avalanche123/Imagine




Jordi Boggiano                                             Company http://nelm.io
http://twitter.com/seldaek                                     Blog http://seld.be
Buzz
               HTTP requests
                       API that doesn't suck
                       Wraps around CURL
               http://github.com/kriswallsmith/Buzz




Jordi Boggiano                                        Company http://nelm.io
http://twitter.com/seldaek                                Blog http://seld.be
Goutte
               Web Crawler
                       Supports CSS3 selectors to extract content
                       Easily follow links, submit forms, etc.
                       Good example of code re-use (Sf2/ZF2
                       components)
               http://github.com/fabpot/Goutte




Jordi Boggiano                                               Company http://nelm.io
http://twitter.com/seldaek                                       Blog http://seld.be
I can't list them all.




Jordi Boggiano                                        Company http://nelm.io
http://twitter.com/seldaek                                Blog http://seld.be
GitHub




Jordi Boggiano                        Company http://nelm.io
http://twitter.com/seldaek                Blog http://seld.be
Git will hurt you
                             Read http://progit.org - it's free.




Jordi Boggiano                                                     Company http://nelm.io
http://twitter.com/seldaek                                             Blog http://seld.be
GitHub is your friend
                       No need to track down a developer's
                       email. Hit fork, create a branch, then send
                       a pull request
                       Push code, get immediate attention and
                       contributors
                       README.mdown in every repository
                       200 Symfony2 contributors, still in beta!




Jordi Boggiano                                                Company http://nelm.io
http://twitter.com/seldaek                                        Blog http://seld.be
Best Practices




Jordi Boggiano                                Company http://nelm.io
http://twitter.com/seldaek                        Blog http://seld.be
MIT License
               Free as in free.




Jordi Boggiano                                  Company http://nelm.io
http://twitter.com/seldaek                          Blog http://seld.be
Autoload with PSR-0
               01   //   One class per file
               02   //   First bit should be a vendor name (your project, company, ..)
               03   //   This should sit in <project>/Nelmio/Bar/Baz.php
               04   //   WATCH THE CASE!
               05
               06   namespace NelmioBar;
               07
               08   class Baz
               09   {
               10   }

               http://tinyurl.com/psr0-standard




Jordi Boggiano                                                                           Company http://nelm.io
http://twitter.com/seldaek                                                                   Blog http://seld.be
PEAR-style Coding Standards
               01   namespace FooBar;
               02
               03   class Baz
               04   {
               05       public $foo;
               06
               07            public function __construct()
               08            {
               09                $stuff = array('Coding Style');
               10                if (true) {
               11                    foreach ($stuff as $blob) {
               12                        echo "happy $blob!";
               13                    }
               14                } else {
               15                    echo "dead kittens";
               16                }
               17            }
               18   }

               http://pear.php.net/manual/en/standards.php



Jordi Boggiano                                                     Company http://nelm.io
http://twitter.com/seldaek                                             Blog http://seld.be
Remember, kids, standards
                               are NOT about taste




Jordi Boggiano                                           Company http://nelm.io
http://twitter.com/seldaek                                   Blog http://seld.be
Testing
                       Tests are always good, but for libraries
                       they're a must.
                       Typing phpunit in <project>/ is all I want
                       to know.




Jordi Boggiano                                                Company http://nelm.io
http://twitter.com/seldaek                                        Blog http://seld.be
Composer




Jordi Boggiano                          Company http://nelm.io
http://twitter.com/seldaek                  Blog http://seld.be
Package Management for PHP
                       Mostly inspired by npm and bundler
                       Advanced dependency resolving
                       Install project dependencies locally




Jordi Boggiano                                                Company http://nelm.io
http://twitter.com/seldaek                                        Blog http://seld.be
Compose great things with small libraries
                       Rely on proven code to do common tasks
                       Simplify old APIs (e.g. Imagine, Buzz)




Jordi Boggiano                                                 Company http://nelm.io
http://twitter.com/seldaek                                         Blog http://seld.be
composer.json (lib)
               01 {
               02            "name": "Monolog",
               03            "description": "Logging for PHP 5.3",
               04            "keywords": ["log","logging"],
               05            "homepage": "http://github.com/Seldaek/monolog",
               06            "version": "1.0.0",
               07            "license": "MIT",
               08            "authors": [
               09                {
               10                    "name": "Jordi Boggiano",
               11                    "email": "j.boggiano@seld.be",
               12                    "homepage": "http://seld.be"
               13                }
               14            ],
               15            "require": {
               16                "php": ">=5.3.0"
               17            }
               18 }




Jordi Boggiano                                                                  Company http://nelm.io
http://twitter.com/seldaek                                                          Blog http://seld.be
composer.json (project)
               01 {
               02            "repositories": {
               03                "AwesomeLib": {
               04                    "git": "git://github.com/Jim/AwesomeLib.git"
               05                },
               06                "GreatLib": {
               07                    "git-bare": {
               08                        "url": "git://github.com/Bob/GreatLib.git",
               09                        "version": "1.0.0"
               10                    }
               11                }
               12            },
               13            "require": {
               14                "Twig": ">=1.0.0",
               15                "AwesomeLib": "latest",
               16                "GreatLib": "1.0.0",
               17                "Monolog": "latest"
               18            }
               19 }




Jordi Boggiano                                                                         Company http://nelm.io
http://twitter.com/seldaek                                                                 Blog http://seld.be
Demo, kind of.
                             (blame @naderman :)




Jordi Boggiano                                     Company http://nelm.io
http://twitter.com/seldaek                             Blog http://seld.be
Fear code re-use no more.




Jordi Boggiano                                       Company http://nelm.io
http://twitter.com/seldaek                               Blog http://seld.be
Last words




Jordi Boggiano                            Company http://nelm.io
http://twitter.com/seldaek                    Blog http://seld.be
Namespace adoption, in effect,
                     opens up a world of
                        possibilities.




Jordi Boggiano                               Company http://nelm.io
http://twitter.com/seldaek                       Blog http://seld.be
Open up your mind,
                              we're not alone.




Jordi Boggiano                                    Company http://nelm.io
http://twitter.com/seldaek                            Blog http://seld.be
Share your code
                             and collaborate.




Jordi Boggiano                                  Company http://nelm.io
http://twitter.com/seldaek                          Blog http://seld.be
Thank you.




Jordi Boggiano                            Company http://nelm.io
http://twitter.com/seldaek                    Blog http://seld.be
Feedback please on:
                         http://joind.in/3489
                                Slides:
                         http://slides.seld.be
                             Contact me:
                       @seldaek || jordi@nelm.io


Jordi Boggiano                                 Company http://nelm.io
http://twitter.com/seldaek                         Blog http://seld.be

Más contenido relacionado

Similar a international PHP2011_Jordi Boggiano_PHP Reset

Similar a international PHP2011_Jordi Boggiano_PHP Reset (20)

Dependency Management with Composer
Dependency Management with ComposerDependency Management with Composer
Dependency Management with Composer
 
Of metacello, git, scripting and things
Of metacello, git, scripting and thingsOf metacello, git, scripting and things
Of metacello, git, scripting and things
 
SWONtech News for May, 2012
SWONtech News for May, 2012SWONtech News for May, 2012
SWONtech News for May, 2012
 
How to create a real time chat application using socket.io, golang, and vue js-
How to create a real time chat application using socket.io, golang, and vue js-How to create a real time chat application using socket.io, golang, and vue js-
How to create a real time chat application using socket.io, golang, and vue js-
 
Arduino for Designers
Arduino for DesignersArduino for Designers
Arduino for Designers
 
Cocktails – Shaken, Not Stirred @osdc.tw
Cocktails – Shaken, Not Stirred @osdc.twCocktails – Shaken, Not Stirred @osdc.tw
Cocktails – Shaken, Not Stirred @osdc.tw
 
Social coding をもっと楽しみたいあなたへ
Social coding をもっと楽しみたいあなたへSocial coding をもっと楽しみたいあなたへ
Social coding をもっと楽しみたいあなたへ
 
Design of a BIOLOID Scorpion Report
Design of a BIOLOID Scorpion ReportDesign of a BIOLOID Scorpion Report
Design of a BIOLOID Scorpion Report
 
Jabber Bot
Jabber BotJabber Bot
Jabber Bot
 
Tales from the OSGi trenches
Tales from the OSGi trenchesTales from the OSGi trenches
Tales from the OSGi trenches
 
Building and deploying Cocoa applications with ChocTop
Building and deploying Cocoa applications with ChocTopBuilding and deploying Cocoa applications with ChocTop
Building and deploying Cocoa applications with ChocTop
 
Zero To Dojo
Zero To DojoZero To Dojo
Zero To Dojo
 
LeapMotion for Web with React and Flux
LeapMotion for Web with React and FluxLeapMotion for Web with React and Flux
LeapMotion for Web with React and Flux
 
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
 
Ultrabootstrapping: Launching a Startup for Less Than $1000
Ultrabootstrapping: Launching a Startup for Less Than $1000Ultrabootstrapping: Launching a Startup for Less Than $1000
Ultrabootstrapping: Launching a Startup for Less Than $1000
 
Dojo: Getting Started Today
Dojo: Getting Started TodayDojo: Getting Started Today
Dojo: Getting Started Today
 
Dojo tutorial
Dojo tutorialDojo tutorial
Dojo tutorial
 
20150317 firefox os_studymtg_engver
20150317 firefox os_studymtg_engver20150317 firefox os_studymtg_engver
20150317 firefox os_studymtg_engver
 
Tales from the OSGi Trenches - Bertrand Delacretaz
Tales from the OSGi Trenches - Bertrand DelacretazTales from the OSGi Trenches - Bertrand Delacretaz
Tales from the OSGi Trenches - Bertrand Delacretaz
 
Gerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub pluginGerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub plugin
 

Más de smueller_sandsmedia

webinale2011_Kai Radusch_Landingpage-Optimierung für Adwords-Kampagnen
webinale2011_Kai Radusch_Landingpage-Optimierung für Adwords-Kampagnenwebinale2011_Kai Radusch_Landingpage-Optimierung für Adwords-Kampagnen
webinale2011_Kai Radusch_Landingpage-Optimierung für Adwords-Kampagnen
smueller_sandsmedia
 
webinale 2011_Gabriel Yoran_Der Schlüssel zum erfolg: Besser aussehen, als ma...
webinale 2011_Gabriel Yoran_Der Schlüssel zum erfolg: Besser aussehen, als ma...webinale 2011_Gabriel Yoran_Der Schlüssel zum erfolg: Besser aussehen, als ma...
webinale 2011_Gabriel Yoran_Der Schlüssel zum erfolg: Besser aussehen, als ma...
smueller_sandsmedia
 
international PHP2011_Henning Wolf_ Mit Retrospektivenzu erfolgreichen Projekten
international PHP2011_Henning Wolf_ Mit Retrospektivenzu erfolgreichen Projekteninternational PHP2011_Henning Wolf_ Mit Retrospektivenzu erfolgreichen Projekten
international PHP2011_Henning Wolf_ Mit Retrospektivenzu erfolgreichen Projekten
smueller_sandsmedia
 
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnitinternational PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
smueller_sandsmedia
 
international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Archit...
international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Archit...international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Archit...
international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Archit...
smueller_sandsmedia
 
webinale2011_Chris Mills_Brave new world of HTML5Html5
webinale2011_Chris Mills_Brave new world of HTML5Html5webinale2011_Chris Mills_Brave new world of HTML5Html5
webinale2011_Chris Mills_Brave new world of HTML5Html5
smueller_sandsmedia
 
international PHP2011_J.Hartmann_DevOps für PHP
international PHP2011_J.Hartmann_DevOps für PHPinternational PHP2011_J.Hartmann_DevOps für PHP
international PHP2011_J.Hartmann_DevOps für PHP
smueller_sandsmedia
 
webinale2011_Daniel Höpfner_Förderprogramme für dummies
webinale2011_Daniel Höpfner_Förderprogramme für dummieswebinale2011_Daniel Höpfner_Förderprogramme für dummies
webinale2011_Daniel Höpfner_Förderprogramme für dummies
smueller_sandsmedia
 

Más de smueller_sandsmedia (8)

webinale2011_Kai Radusch_Landingpage-Optimierung für Adwords-Kampagnen
webinale2011_Kai Radusch_Landingpage-Optimierung für Adwords-Kampagnenwebinale2011_Kai Radusch_Landingpage-Optimierung für Adwords-Kampagnen
webinale2011_Kai Radusch_Landingpage-Optimierung für Adwords-Kampagnen
 
webinale 2011_Gabriel Yoran_Der Schlüssel zum erfolg: Besser aussehen, als ma...
webinale 2011_Gabriel Yoran_Der Schlüssel zum erfolg: Besser aussehen, als ma...webinale 2011_Gabriel Yoran_Der Schlüssel zum erfolg: Besser aussehen, als ma...
webinale 2011_Gabriel Yoran_Der Schlüssel zum erfolg: Besser aussehen, als ma...
 
international PHP2011_Henning Wolf_ Mit Retrospektivenzu erfolgreichen Projekten
international PHP2011_Henning Wolf_ Mit Retrospektivenzu erfolgreichen Projekteninternational PHP2011_Henning Wolf_ Mit Retrospektivenzu erfolgreichen Projekten
international PHP2011_Henning Wolf_ Mit Retrospektivenzu erfolgreichen Projekten
 
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnitinternational PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
 
international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Archit...
international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Archit...international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Archit...
international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Archit...
 
webinale2011_Chris Mills_Brave new world of HTML5Html5
webinale2011_Chris Mills_Brave new world of HTML5Html5webinale2011_Chris Mills_Brave new world of HTML5Html5
webinale2011_Chris Mills_Brave new world of HTML5Html5
 
international PHP2011_J.Hartmann_DevOps für PHP
international PHP2011_J.Hartmann_DevOps für PHPinternational PHP2011_J.Hartmann_DevOps für PHP
international PHP2011_J.Hartmann_DevOps für PHP
 
webinale2011_Daniel Höpfner_Förderprogramme für dummies
webinale2011_Daniel Höpfner_Förderprogramme für dummieswebinale2011_Daniel Höpfner_Förderprogramme für dummies
webinale2011_Daniel Höpfner_Förderprogramme für dummies
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 

international PHP2011_Jordi Boggiano_PHP Reset

  • 1. PHP Reset Jordi Boggiano @seldaek http://nelm.io/ Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 2. Disclaimer This is not about REST Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 3. About Me Belgian living in Zürich Weby stuff for 10 years http://seld.be Symfony2 core dev and other OSS contributions http://github.com/Seldaek Recently started Nelmio http://nelm.io We do Symfony2 & Frontend Performance consulting Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 4. Planning Small Rant New Frameworks & Libraries GitHub Commercial Break Best Practices Composer Wishful Thinking Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 5. A bit of history Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 6. PHP4 - 22-May-2000 01 class Foo_Bar_Baz 02 { 03 var $foo; 04 05 function Foo_Bar_Baz() 06 { 07 } 08 09 function bar() 10 { 11 } 12 } Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 7. PHP5 - 13-Jul-2004 01 class Foo_Bar_Baz 02 { 03 public $foo; 04 05 public function __construct() 06 { 07 } 08 09 private function bar() 10 { 11 } 12 } Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 8. Could you spot the differences? Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 9. Yet seven years later ~20% of servers still run PHP4 Source: @iliaa's PHP Advent article, December 2010. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 10. PHP5.3 - 30-Jun-2009 01 namespace FooBar; 02 03 class Baz 04 { 05 public $foo; 06 07 public function __construct() 08 { 09 } 10 11 private function bar() 12 { 13 } 14 } Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 11. Again, not much has changed. But it changes everything. BackslashMeansNoBackwardsCompatibility Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 12. We've been sitting on our asses for too long. It's time for a change. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 13. New Frameworks Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 14. Symfony2 Lithium Silex ZF2 ... . Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 15. New Libraries Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 16. Assetic Asset management & processing Combine & Compress JS, CSS Compile CoffeeScript, SASS, LESS, .. Re-encode images All on the fly with cache or pre-processed Inspired by Python's WebAssets Shipped with Symfony2 http://github.com/kriswallsmith/assetic Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 17. Doctrine2 DBAL, ORM, ODMs Document stores (MongoDB, CouchDB, PHPCR, XML) Common interfaces allow for interop and knowledge re-use Propel2 builds on top of it Shipped with Symfony2 http://github.com/doctrine Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 18. Monolog Logging FingersCrossedHandler for production Log to files, FirePHP, emails, etc. Inspired by Python's Logbook Shipped with Symfony2 http://github.com/Seldaek/monolog Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 19. Twig Template engine Automatic escaping Separation of concerns (Readability) Inspired by Python's Jinja2 Shipped with Symfony2 http://github.com/fabpot/Twig Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 20. Gaufrette Filesystem abstraction Code once, store files anywhere S3, Memory, FTP, Rackspace, .. Transparently cache calls to slow backends http://github.com/knplabs/Gaufrette Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 21. Snappy Generates PDF/images from webpages Uses wkhtmltopdf/wkhtmltoimage Good example of a small single-purpose library http://github.com/knplabs/snappy Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 22. Imagine Image manipulation API that doesn't suck Supports GD2, Imagick, Gmagick Easily resize, crop, and more Inspired by Python's PIL & others http://github.com/avalanche123/Imagine Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 23. Buzz HTTP requests API that doesn't suck Wraps around CURL http://github.com/kriswallsmith/Buzz Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 24. Goutte Web Crawler Supports CSS3 selectors to extract content Easily follow links, submit forms, etc. Good example of code re-use (Sf2/ZF2 components) http://github.com/fabpot/Goutte Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 25. I can't list them all. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 26. GitHub Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 27. Git will hurt you Read http://progit.org - it's free. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 28. GitHub is your friend No need to track down a developer's email. Hit fork, create a branch, then send a pull request Push code, get immediate attention and contributors README.mdown in every repository 200 Symfony2 contributors, still in beta! Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 29. Best Practices Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 30. MIT License Free as in free. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 31. Autoload with PSR-0 01 // One class per file 02 // First bit should be a vendor name (your project, company, ..) 03 // This should sit in <project>/Nelmio/Bar/Baz.php 04 // WATCH THE CASE! 05 06 namespace NelmioBar; 07 08 class Baz 09 { 10 } http://tinyurl.com/psr0-standard Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 32. PEAR-style Coding Standards 01 namespace FooBar; 02 03 class Baz 04 { 05 public $foo; 06 07 public function __construct() 08 { 09 $stuff = array('Coding Style'); 10 if (true) { 11 foreach ($stuff as $blob) { 12 echo "happy $blob!"; 13 } 14 } else { 15 echo "dead kittens"; 16 } 17 } 18 } http://pear.php.net/manual/en/standards.php Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 33. Remember, kids, standards are NOT about taste Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 34. Testing Tests are always good, but for libraries they're a must. Typing phpunit in <project>/ is all I want to know. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 35. Composer Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 36. Package Management for PHP Mostly inspired by npm and bundler Advanced dependency resolving Install project dependencies locally Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 37. Compose great things with small libraries Rely on proven code to do common tasks Simplify old APIs (e.g. Imagine, Buzz) Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 38. composer.json (lib) 01 { 02 "name": "Monolog", 03 "description": "Logging for PHP 5.3", 04 "keywords": ["log","logging"], 05 "homepage": "http://github.com/Seldaek/monolog", 06 "version": "1.0.0", 07 "license": "MIT", 08 "authors": [ 09 { 10 "name": "Jordi Boggiano", 11 "email": "j.boggiano@seld.be", 12 "homepage": "http://seld.be" 13 } 14 ], 15 "require": { 16 "php": ">=5.3.0" 17 } 18 } Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 39. composer.json (project) 01 { 02 "repositories": { 03 "AwesomeLib": { 04 "git": "git://github.com/Jim/AwesomeLib.git" 05 }, 06 "GreatLib": { 07 "git-bare": { 08 "url": "git://github.com/Bob/GreatLib.git", 09 "version": "1.0.0" 10 } 11 } 12 }, 13 "require": { 14 "Twig": ">=1.0.0", 15 "AwesomeLib": "latest", 16 "GreatLib": "1.0.0", 17 "Monolog": "latest" 18 } 19 } Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 40. Demo, kind of. (blame @naderman :) Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 41. Fear code re-use no more. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 42. Last words Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 43. Namespace adoption, in effect, opens up a world of possibilities. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 44. Open up your mind, we're not alone. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 45. Share your code and collaborate. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 46. Thank you. Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be
  • 47. Feedback please on: http://joind.in/3489 Slides: http://slides.seld.be Contact me: @seldaek || jordi@nelm.io Jordi Boggiano Company http://nelm.io http://twitter.com/seldaek Blog http://seld.be