Successfully reported this slideshow.

An introduction to Phing the PHP build system

2

Share

Upcoming SlideShare
Phing
Phing
Loading in …3
×
1 of 25
1 of 25

An introduction to Phing the PHP build system

2

Share

Download to read offline

Description

Talk given on 27th January 2012 at PHP Benelux 2012 conference in Antwerp, Belgium.

An insight into the Phing build system for PHP, why and how you might use it along with where it sits with related tools such as PHPUnit, PHP Code Sniffer, PHP Mess Detector etc. We will also take a brief look at how Phing can integrate with Continuous Integration, taking Jenkins as our example. We will also be including some simple practical demos of Phing in action!

Transcript

  1. 1. Who? Jeremy Coates, MD Magma Digital Ltd jeremy@phpnw.org.uk @phpcodemonkey #phpnw linkedin.com/in/ jeremycoates facebook.com/jeremycoates
  2. 2. Content Phing Build System (basics) What is it / Why use it What can it do Example build files (+ live demo!) Phing & CI (Jenkins) Questions
  3. 3. What's this Phing about? The TPhing Build system - Based on Ant (Apache) - PHP(5) based - No extra dependencies - Cross platform flickr.com/photos/
  4. 4. I don't need no stinking 'Build System' Do you write PHP Apps or just web pages? - Configuration - Deployment - Committing - Testing - Documenting
  5. 5. I don't need no stinking 'Build System' Do you write PHP Apps or just web pages? - Configuration - Preparation - Deployment - Predictability - Committing - Confidence - Testing - Documenting - Familiarity
  6. 6. What can this Phing do? Pretty well everything bar make tea! Anything a shell script can do (FTP, SCP, Chown, Touch, SSH etc.) for deployment Integrate with version control (CVS, SVN, Git) Code quality checks (phpcs, pdepend, phpmd etc.)
  7. 7. Oh is that all?
  8. 8. Oh is that all? Unit tests (phpunit, simpletest) Database deployment (dbdeploy) Lint (PHP, JS, XML) Reporting (code coverage, PHPDoc, DocBLox) Not enough? Write your own Tasks or Exec
  9. 9. What Phings can I use?
  10. 10. How's it work? Phing shell script, launches Phing PHP App + your XML build file Build file contains: - Properties - Targets - Tasks flickr.com/photos/jm3/4814208649
  11. 11. Hello World!
  12. 12. Example build script
  13. 13. phing clean
  14. 14. prepare
  15. 15. deploy staging
  16. 16. deploy live
  17. 17. Continuous Integration Remove reliance on Human nature Regular automated builds (phing/ant) Report on build status
  18. 18. CI Reports For many of the tools we're already familiar with Phing targets: - phpcs, pdepend, phpcpd, phpmd, phpunit, phpcb etc.
  19. 19. Phing - context Phing vs. Ant: Ant is inspiration for Phing. Phing doesn't need JVM & is LGPL (Ant: Apache v2) Phing 1: PHP4 Phing 2: PHP5.2+ phing version 2.4.9 Michiel Rook: Project Lead @michieltcs
  20. 20. Resources http://www.phing.info @phingofficial http://www.phing.info/docs/guide/ stable/ http://jenkins-ci.org http://dbdeploy.com http://ant.apache.org
  21. 21. Questions?
  22. 22. Feedback? Jeremy Coates, MD Magma Digital Ltd Please provide feedback: https://joind.in/4759

Editor's Notes

  • \n\n
  • \n\n
  • \n\n
  • Phing = PHing Is Not Gnu make\n\nDeveloper build toolkit - tool for every job (almost)!\nLGPL Licensed\n\nMy knowledge of Phing about 20%, however there's great documentation!\n
  • Web applications require deployment, packaging, testing, setting permissions, configuration, creating log files\nDoing so by hand every time is scary!\n
  • \n\n
  • \n\n
  • \n\n
  • Project: root XML node\nTargets: collection of tasks, together for a reason\nTasks: call to specific action e.g. copy, symlink etc.\n
  • \n\n
  • \n\n
  • Fileset selectors - powerful matching, as well as **\ndate based, size, file/dir, related files present\nMapper - also a good tool, convert filenames during build\nFilters (filterchains) - transform data during build, e.g. strip comments, replace values in config files (via regex)\n<php> task - evaluate PHP expression/Fn call result stored in property\nEmbed PHP direct in build file using <adhoc> task (Needs to be <adhoc><![CDATA[...]]></adhoc>\n
  • \n\n
  • \n\n
  • \n\n
  • \n\n
  • CI Tools watch for commits, then kick start the build process, in this case Phing\nAlternatives to Jenkins: CruiseControl (Phing builder), Xinc - PHP CI tool, uses Phing\n
  • \n\n
  • \n\n
  • \n\n
  • \n\n
  • \n\n
  • \n\n
  • Description

    Talk given on 27th January 2012 at PHP Benelux 2012 conference in Antwerp, Belgium.

    An insight into the Phing build system for PHP, why and how you might use it along with where it sits with related tools such as PHPUnit, PHP Code Sniffer, PHP Mess Detector etc. We will also take a brief look at how Phing can integrate with Continuous Integration, taking Jenkins as our example. We will also be including some simple practical demos of Phing in action!

    Transcript

    1. 1. Who? Jeremy Coates, MD Magma Digital Ltd jeremy@phpnw.org.uk @phpcodemonkey #phpnw linkedin.com/in/ jeremycoates facebook.com/jeremycoates
    2. 2. Content Phing Build System (basics) What is it / Why use it What can it do Example build files (+ live demo!) Phing & CI (Jenkins) Questions
    3. 3. What's this Phing about? The TPhing Build system - Based on Ant (Apache) - PHP(5) based - No extra dependencies - Cross platform flickr.com/photos/
    4. 4. I don't need no stinking 'Build System' Do you write PHP Apps or just web pages? - Configuration - Deployment - Committing - Testing - Documenting
    5. 5. I don't need no stinking 'Build System' Do you write PHP Apps or just web pages? - Configuration - Preparation - Deployment - Predictability - Committing - Confidence - Testing - Documenting - Familiarity
    6. 6. What can this Phing do? Pretty well everything bar make tea! Anything a shell script can do (FTP, SCP, Chown, Touch, SSH etc.) for deployment Integrate with version control (CVS, SVN, Git) Code quality checks (phpcs, pdepend, phpmd etc.)
    7. 7. Oh is that all?
    8. 8. Oh is that all? Unit tests (phpunit, simpletest) Database deployment (dbdeploy) Lint (PHP, JS, XML) Reporting (code coverage, PHPDoc, DocBLox) Not enough? Write your own Tasks or Exec
    9. 9. What Phings can I use?
    10. 10. How's it work? Phing shell script, launches Phing PHP App + your XML build file Build file contains: - Properties - Targets - Tasks flickr.com/photos/jm3/4814208649
    11. 11. Hello World!
    12. 12. Example build script
    13. 13. phing clean
    14. 14. prepare
    15. 15. deploy staging
    16. 16. deploy live
    17. 17. Continuous Integration Remove reliance on Human nature Regular automated builds (phing/ant) Report on build status
    18. 18. CI Reports For many of the tools we're already familiar with Phing targets: - phpcs, pdepend, phpcpd, phpmd, phpunit, phpcb etc.
    19. 19. Phing - context Phing vs. Ant: Ant is inspiration for Phing. Phing doesn't need JVM & is LGPL (Ant: Apache v2) Phing 1: PHP4 Phing 2: PHP5.2+ phing version 2.4.9 Michiel Rook: Project Lead @michieltcs
    20. 20. Resources http://www.phing.info @phingofficial http://www.phing.info/docs/guide/ stable/ http://jenkins-ci.org http://dbdeploy.com http://ant.apache.org
    21. 21. Questions?
    22. 22. Feedback? Jeremy Coates, MD Magma Digital Ltd Please provide feedback: https://joind.in/4759

    Editor's Notes

  • \n\n
  • \n\n
  • \n\n
  • Phing = PHing Is Not Gnu make\n\nDeveloper build toolkit - tool for every job (almost)!\nLGPL Licensed\n\nMy knowledge of Phing about 20%, however there's great documentation!\n
  • Web applications require deployment, packaging, testing, setting permissions, configuration, creating log files\nDoing so by hand every time is scary!\n
  • \n\n
  • \n\n
  • \n\n
  • Project: root XML node\nTargets: collection of tasks, together for a reason\nTasks: call to specific action e.g. copy, symlink etc.\n
  • \n\n
  • \n\n
  • Fileset selectors - powerful matching, as well as **\ndate based, size, file/dir, related files present\nMapper - also a good tool, convert filenames during build\nFilters (filterchains) - transform data during build, e.g. strip comments, replace values in config files (via regex)\n<php> task - evaluate PHP expression/Fn call result stored in property\nEmbed PHP direct in build file using <adhoc> task (Needs to be <adhoc><![CDATA[...]]></adhoc>\n
  • \n\n
  • \n\n
  • \n\n
  • \n\n
  • CI Tools watch for commits, then kick start the build process, in this case Phing\nAlternatives to Jenkins: CruiseControl (Phing builder), Xinc - PHP CI tool, uses Phing\n
  • \n\n
  • \n\n
  • \n\n
  • \n\n
  • \n\n
  • \n\n
  • More Related Content

    Related Books

    Free with a 30 day trial from Scribd

    See all

    ×