An introduction to Phing the PHP build system
Upcoming SlideShare
Loading in...5
×
 

An introduction to Phing the PHP build system

on

  • 3,833 views

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

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!

Statistics

Views

Total Views
3,833
Views on SlideShare
3,830
Embed Views
3

Actions

Likes
2
Downloads
37
Comments
0

3 Embeds 3

http://www.php-talks.com 1
http://www.slashdocs.com 1
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \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 task - evaluate PHP expression/Fn call result stored in property\nEmbed PHP direct in build file using task (Needs to be <![CDATA[...]]>\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

An introduction to Phing the PHP build system An introduction to Phing the PHP build system Presentation Transcript

  • Who?Jeremy Coates, MD MagmaDigital Ltdjeremy@phpnw.org.uk@phpcodemonkey#phpnwlinkedin.com/in/jeremycoatesfacebook.com/jeremycoates
  • ContentPhing Build System (basics)What is it / Why use itWhat can it doExample build files (+ live demo!)Phing & CI (Jenkins)Questions
  • Whats this Phing about? The TPhingBuild system- Based on Ant (Apache)- PHP(5) based- No extra dependencies- Cross platform flickr.com/photos/
  • I dont need nostinking Build SystemDo you write PHP Apps or just web pages?- Configuration- Deployment- Committing- Testing- Documenting
  • I dont need nostinking Build SystemDo you write PHP Apps or just web pages?- Configuration - Preparation- Deployment - Predictability- Committing - Confidence- Testing- Documenting - Familiarity
  • What can this Phing do?Pretty well everything bar make tea!Anything a shell script can do (FTP, SCP,Chown, Touch, SSH etc.) for deploymentIntegrate with version control (CVS, SVN,Git)Code quality checks (phpcs, pdepend,phpmd etc.)
  • Oh is that all?
  • 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
  • What Phings can I use?
  • Hows it work?Phing shell script,launches Phing PHPApp + your XML buildfileBuild file contains:- Properties- Targets- Tasks flickr.com/photos/jm3/4814208649
  • Hello World!
  • Example build script
  • phing clean
  • prepare
  • deploy staging
  • deploy live
  • Continuous IntegrationRemove relianceon Human natureRegular automatedbuilds (phing/ant)Report on buildstatus
  • CI ReportsFor many of thetools were alreadyfamiliar withPhing targets:- phpcs, pdepend, phpcpd, phpmd, phpunit, phpcb etc.
  • Phing - contextPhing vs. Ant: Ant is inspiration forPhing. Phing doesnt need JVM & isLGPL (Ant: Apache v2)Phing 1: PHP4Phing 2: PHP5.2+ phing version 2.4.9Michiel Rook: Project Lead @michieltcs
  • Resourceshttp://www.phing.info @phingofficialhttp://www.phing.info/docs/guide/stable/http://jenkins-ci.orghttp://dbdeploy.comhttp://ant.apache.org
  • Questions?
  • Feedback?Jeremy Coates, MDMagma Digital LtdPlease providefeedback:https://joind.in/4759