Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Today's Thriving PHP Developer Ecosystem

Today's Thriving PHP Developer Ecosystem

Most people who actively work with PHP every day rarely confine themselves to just PHP.

PHP Developers have access to a nearly dizzying array of tools, packages, language features, QA tools and countless frameworks and styles to develop with. In this Tour of the PHP Ecosystem, long time PHP enthusiast Dan Holmes will attempt to highlight many of the projects and developments that have come of age in recent years.

Whether you have long settled on one particular style or framework for development, or just looking at PHP for the first time, we are sure you will spot something fresh you hadn't seen before.

Presented to the PHP User Group of Kansas City.

Daniel Holmes

July 22, 2012

More Decks by Daniel Holmes

Other Decks in Programming


  1. And THIS is PHP phpBB phpExcel CakePHP CodeIgnighter FuelPHP Silex

    Symfony Zend Framework Doctrine all logos are Trademarked by their respective owners
  2. PHP's Many Uses: Who in here has... • Added simple

    data or dates to a web page • Extended a CMS like WordPress or Drupal ? • Extended other packaged systems ◦ Shopping Carts ◦ Photo Galleries • Automation / Backend Scripting ◦ VAST collection of interfaces to c libraries make a very powerful tool ◦ XML Parsing - Even XSL / XPAT ◦ Image Processing with GD / ImageMagic ◦ Integration with CURL
  3. PHP's Many Uses: Who in here is using PHP for...

    • Creating Stand Alone Web-Applciations • Writing Facebook Applications • Writing Facebook • REST / SOAP / RPC API Development
  4. Why PHP is still so popular • Massive and Excellent

    Community • Ultra-low barriers to entry • Scales along with the developer • Integrate, Interop or Glue Almost Anything! • Runs on almost anything and anywhere all logos are Trademarked by their respective owners
  5. Great Hosting Options Cloud / Shared / Dedicated Platform as

    a Service all logos are Trademarked by their respective owners
  6. Server Architectures • Apache / mod_php • Apache / fastcgi

    PHP • Nginx / Apache / mod_php + APC • Nginx / PHP-FPM + APC • Nginx / PHP-FPM + APC + Memcached
  7. No Server? No Problem! Two single-step install options for Linux/Mac/Win

    Zend Server Community Edition XAMPP Includes PHP, Apache, MySQL and Extras!
  8. When you want to carry your own cloud of servers

    with you everywhere VirtualBox
  9. Just a few Tools to Edit your PHP Many More

    at http://en.wikipedia.org/wiki/List_of_PHP_editors Text Editors • Textmate 2 • Sublime Text 2 • Notepad ++ • VIM! w/wo Lots of plugins And no, not emacs. We won. Move on. ;-) IDE's (Yes, with run-time debugging / profiling) • PHP Storm • Netbeans • Zend Studio / Eclipse PDT http://coding.smashingmagazine.com/2009/02/11/the-big- php-ides-test-why-use-oneand-which-to-choose/
  10. • Has been evolving for over 17 years • New

    versions rarely break compatibility • Backed / influenced by hundreds of C libs • SSI, Procedural, Object-Oriented, Reflective • Grown to support TDD, BDD, CI, DI, etc ;-) The Friendly and Versatile Platypus
  11. These last three shots were from Thijs Lensselink's site: http://lenss.nl/tag/elephpant/

    Go buy one of these little blue (or pink) creatures at http://elephpant.com/ ~$12 bucks
  12. PHP: Always getting new powers • [5.0] Classes, Interfaces, Abstracts,

    Privates, Type Hinting with Class Names • [5.1] PDO Included by default • [5.2] Filter Validation, JSON support Just as a reminder, 5.0 came out in July, 2004. 5.2 in 2006
  13. PHP: Always getting new powers - 5.3 (2009) • Namespaces

    • Late Static Bindings • Closures • Nested Exceptions PCRE, Reflection and SPL are now ALWAYS available! "They" can't Build PHP w/o them!
  14. PHP: Always getting new powers - 5.4 (Mar) • Traits

    • session.upload_progress.enabled • <?= is always available, from now on • register_globals not just deprecated--GONE!
  15. PHP Fun you may have missed • Phar • SPL

    - the Standard PHP Library ◦ RegexIterator class ◦ 13 Standard Exceptions including: OutOfBounds, BadMethodCall, InvalidArgument... ◦ Baseclasses and Interfaces for Iterators, Observers, Heaps, Queues, Stacks and Arrays ◦ All with an Object-Oriented interface ◦ Many with an optional function "front-end"
  16. Just like a bash shell. But it's PHP. In a

    shell. Interactively. Tab Tab.... oooh!
  17. There is a trick though. If it says "Interactive mode

    enabled" That's not the same thing (as you can see above) You need to compile php --with-readline support.
  18. Tell me what these things do: • echo $foo ?:

    "x" ; • $a =[1,2,3,4]; • $b = ['apple'=>['color'=>'green']]; • $tag->getStyles()['font-size']->embiggen(); Syntactic Sugar Or, examples of things language designers do to try and get legitimate discussions moving again
  19. True Power in Knowledge... And PHP Knows how to do

    a lot If you haven't REALLY looked at the PHP documentation lately you should. If you don't know where to start, at least get a feel for the kinds of things it can do http://www.php.net/manual/en/extensions.membership.php
  20. Let's take Databases for example PHP Data Objects (PDO) •

    CUBRID • Firebird/Interbase • IBM DB2 • Informix • MS SQL Server • MySQL • Oracle • PostgreSQL • 4D Direct Driver access over 23 drivers from MongoDB to Paradox and dBase. PECL / Vendor Extensions • Couchbase • Solr • Sphinx
  21. Unit Testing phpt Used mainly for core php PHPUnit Very

    popular, modular unit testing platform There is also SimpleTest, and others. These two just contrast very well.
  22. PHPUnit - ZF1 Framework Support Zend Framework 1 takes a

    different approach by Extending PHPUnit Yep. That's assert by CSS Selector. :-)
  23. Jenkins PHP / Continuous Integration Server • Written in Java

    • Integrates with your VCS repositories • Can run a variety of Tests and reports • Keeps things "clean" • PHP_CodeSniffer, PHPMD, phpDox
  24. Systems Integration Tools Phing! Used to automate • Packaging •

    Deploying • Testing • Anything! Like Ant, but you write your tasks in PHP / XML!
  25. PEAR - Reusable PHP Components • First big package repo

    - PEAR 1.0 was 2003 • Can download, install, update packages • Manages channels of packages • Still VERY important / useful packages • CLI Interface
  26. PEAR - Reusable PHP Components • Mail_Mime, Image_QRcode, Image_Canvas •

    Archive_Tar, Image_Transform • Services_W3C_CSSValidator • Payment Systems, Web Systems, Birtorrent2 • Almost 8.5 million lines of code
  27. Composer • VERY New, but exploding in popularity • Very

    similar to node’s npm or ruby’s bundler • CLI based • Dependencies defined per project • Easily lock to a version, install dependencies • Tasks like creating a skeleton for your latest framework-based project
  28. Using Composer Install Composer Define monolog in your composer. json

    file Install Deps Create an unrelated project $ curl -s http://getcomposer.org/installer | php $ vim /my/project/composer.json { "require": { "monolog/monolog": "1.0.*" } } $ alias composer="php composer.phar" $ composer install $ composer create-project doctrine/orm path 2.2.0
  29. Composer Packages live in a VCS " Packagist is the

    main package repository for composer, and it is enabled by default. Anything that is published on packagist is available automatically through composer. " - http://getcomposer.org
  30. Using Packagist Finding packages is as easy as typing keywords

    Click in to see who all is on it, what it provides, etc
  31. We like our frameworks. We must...we have so many! Cake

    is: • MVC • Convention Driven • Rapid Development Learn More at: http://cakephp.org
  32. We like our frameworks. We must...we have so many! Symfony

    is one of the leading first-class, large-scale frameworks of the PHP community. That Doesn't mean it isn't full of light agile tricks. Here, we see how it can use annotations to dynamically choose different views depending on the request URL More on Symfony: http://symfony.com/
  33. We like our frameworks. We must...we have so many! More

    on Zend Framework: http://framework.zend.com
  34. Micro Frameworks Taken from examples at: http://www.slimframework. com/documentation/stable Micro Frameworks

    are: • lean / fast • Build with HTTP handling in mind • Provides an excellent way to build REST APIs
  35. Micro Frameworks • Silex is a little different • Still

    "micro" but is built on Symfony • Great for HTTP Request APIs • Stilll an excellent choice for traditional applications too • Like Symfony2, Uses Twig for views Be sure to check out more about Silex at: http://silex.sensiolabs.org/
  36. Just looking to query some data... 1. Go to PHP.net

    2. Click on Documentation 3. Click on English (presumably) 4. Scroll down...down 5. Database Security...woah! 6. Scroll Down 7. Persistent Database Connections...Nope. 8. Ah! Database Extensions! *click*
  37. Lost in the land of blog posts PHP.net is one

    of the most complete language resources, anywhere. I love it. I learned with it. I grew with it. Sadly: task-oriented, poorly written blog posts from 2004 are easiest to find. Just Google It!
  38. Lost in the land of blog posts • I want

    to keep growing, but where do I start? • Where does a new developer start? • What does "the right way" even look like? Ahh...ahh. I see what you did there..
  39. PHPTheRightWay.com Now, right off the bat they explain what they

    mean: There is no canonical way to use PHP. However, this website is a humble display of best practices, available options, and good information. It aims to introduce new PHP developers and to rethink seasoned pros with fresh ideas. - http://phptherightway.com
  40. PHPTheRightWay.com A living webpage ready to fork on github Topics

    include: ◦ Getting Started (environnement, etc) ◦ Code Style guide ◦ Language Highlights ◦ Dependency Management ◦ Coding Practices ◦ Databases ◦ Security ◦ Testing ◦ Servers and Deployment ◦ Caching ◦ Resources ◦ Frameworks ◦ Community
  41. PHPTheRightWay.com This site is so very exciting to me personally

    DON'T get lost in the title DON'T feel bad if you learn something DO read the thing start to finish DO get inspired to do a talk on something good
  42. PHP Mentoring Building Strong Developers Mentors "Mentors are teachers and

    counselors and coaches and friends, but they are not perfect and aren't expected to be." Apprentices "Apprentices are students and team members and friends, but they are not perfect and aren't expected to be." - http://phpmentoring.org
  43. We are Just scratching the surface... Things we touched on:

    • Many uses and powers of PHP • Architecture • Development Tools • Language Features • phpqatools.com • PEAR & Composer • (micro) Frameworks Things you will find in phptherightway.com • More Detail, Links, Recommendations • More Ideas • Caching • People to Follow • More PaaS Providers