SlideShare a Scribd company logo
Phing
           Automating PHP build deployment




09/07/12             http://coderinsights.blogspot.in   1
Old Way




09/07/12   http://coderinsights.blogspot.in   2
Why use Build Automation?
“We are human, We get bored,
We forget things, We make mistakes”

•   Improve product quality
•   Consolidate scripts
•   Eliminate repetitive tasks
•   Minimize error (bad builds)
•   Eliminate dependencies (Easier handover)
•   Highly extendible
•   Saves time

09/07/12                http://coderinsights.blogspot.in   3
What is [PHing Is Not Gnumake]
•   It's a PHP project build tool based on Apache Ant
•   Opensource
•   Mostly Cross platform
•   Uses XML build files
•   No required external dependencies
•   Built & optimised for PHP5




09/07/12              http://coderinsights.blogspot.in   4
What can you do?
•   Lots –Not just for deployment
•   SVN tasks
•   PHPUnit/SimpleTest
•   Code analysis tasks
•   PhpDocumentor
•   Zip/Unzip
•   File manipulation
•   Various OS tasks

09/07/12           http://coderinsights.blogspot.in   5
Features




09/07/12   http://coderinsights.blogspot.in   6
Phing Philosophy
• Build scripts contains "Targets"
      – Targets should be small and specialized.
      – Example Targets:
           • clean
              – Clear temporary and cached files
           • copy
              – Copy files to their intended destination
           • migrate
              – Upgrade the database schema



09/07/12                      http://coderinsights.blogspot.in   7
Phing Philosophy
• Targets can have dependencies
      – Target "live" can depend on clean, copy, and
        migrate
      – Meaning, when we run the "live" target, it first
        runs clean, copy, then migrate
           • And any tasks they depend on




09/07/12                   http://coderinsights.blogspot.in   8
Installing Phing
• pear channel-discover pear.phing.info
• pear install phing/Phing
• Want all the dependencies?
      –    pear   config-set preferred_state alpha
      –    pear   install –alldeps phing/Phing
      –    pear   config-set preferred_state stable
      –    pear   install phing/phingdocs
• Also available from:
      – SVN
      – Zip Download

09/07/12                 http://coderinsights.blogspot.in   9
Running Phing
• $> phing –v
      – Lists Phing version
• Phing expects to find a file "build.xml" in the
  current directory
      – build.xml defines the targets
      – You can use the "-f <filename>" flag to
        specify an alternate build file like
           • $> phing -f build-live.xml


09/07/12                http://coderinsights.blogspot.in   10
Syntax
• Build File uses XML
• Standard Elements
      – Task: code that performs a specific function
      – Target: groups of tasks
      – Project: root node
• Variables
      – ${variablename}
      – Conventions
           • Psuedo-Namespaces using periods
           • ${namespace.variable.name}

09/07/12                  http://coderinsights.blogspot.in   11
Basic Conventions
• build.xml
      – Central repository of your top-level tasks
• build-*.xml
      – Can be included into build.xml.
      – Usually for grouping by target (dev, staging,prod)
        or task (migrate, test, etc.)
• build.properties
      – Technically an INI file that contains variables to be
        included by build files.

09/07/12                http://coderinsights.blogspot.in     12
Basic build.xml
  <?xml version="1.0" encoding="UTF-8"?>
  <project name=“opx" default="default" basedir=".">
      <property file="build.properties" />
      <target name="default">
          <echo message="Hello World!" />
      </target>
  </project>




09/07/12              http://coderinsights.blogspot.in   13
Basic build.properties
  source.directory = /mnt/work/

  ## Database Configuration
  db.user = username
  db.pass = password
  db.host = localhost
  db.name = database


   Usage:
   $phing –propertyfile build.properties




09/07/12                        http://coderinsights.blogspot.in   14
Most Useful Elements
• Filesets: define once,use many
      <fileset id="src_crons" dir="${dir.crons_path}/statistic-engine/">
              <include name="*.php"/>
              <exclude name="populate_opx_tables.php" />
      </fileset>


• Mappers & Filters: Transform files during
  copy/move/…
      <copy todir="${build}">
             <fileset refid="files"/>
                     <mapper type="glob" from="*.txt" to="*.new.txt"/>
                     <filterchain>
                             <replaceregexp>
                             <regexp pattern="rn" replace="n"/>
                     <expandproperties/>
                     </replaceregexp>
             </filterchain>
      </copy>



09/07/12                                        http://coderinsights.blogspot.in   15
Executing External Tools
• Nearly all file transfer tools will be external
  commands
• For this we need the Exec task
      <exec command="cp file1 file2" />




09/07/12                http://coderinsights.blogspot.in   16
Examples
SVN, Git
<svncopy username=“pavan“ password="test” repositoryurl="svn://localhost/phing/trunk/“
    todir="svn://localhost/phing/tags/1.0"/>

<svnexport repositoryurl="svn://localhost/project/trunk/” todir="/home/pavan/dev"/>

<svnlastrevision repositoryurl="svn://localhost/project/trunk/” propertyname="lastrev"/>
<echo>Last revision: ${lastrev}</echo>

<svnlastrevision repositoryurl="${deploy.svn}” property="deploy.rev"/>

<svnexport repositoryurl="${deploy.svn}" todir="/www/releases/build-${deploy.rev}"/>




09/07/12                           http://coderinsights.blogspot.in                        17
Examples
Packaging – Tar/Zip
<tar compression="gzip" destFile="package.tgz" basedir="build"/>
    <zip destfile="htmlfiles.zip">
    <fileset dir=".">
            <include name="**/*.html"/>
    </fileset>
</zip>




09/07/12                           http://coderinsights.blogspot.in   18
Examples
Documentation:
      – DocBlox
      – PhpDocumentor
      – ApiGen

<docblox title="Phing API Documentation"
output="docs" quiet="true">
<fileset dir="../../classes">
     <include name="**/*.php"/>
</fileset>
</docblox>


09/07/12                          http://coderinsights.blogspot.in   19
Examples
• SCP/FTP
<scp username="john" password="smith" host="webserver" todir="/www/htdocs/project/">
    <fileset dir="test">
            <include name="*.html"/>
    </fileset>
</scp>

<ftpdeploy host="server01” username="john" password="smit" dir="/var/www">
    <fileset dir=".">
            <include name="*.html"/>
    </fileset>
</ftpdeploy>




09/07/12                         http://coderinsights.blogspot.in                      20
Database Migrations
• Set of delta SQL files (1-create-post.sql)
• Tracks current version of your db in changelog
  table
• Generates do and undo SQL files
CREATE TABLE changelog (
change_number BIGINT NOT NULL,
delta_set VARCHAR(10) NOT NULL,
start_dt TIMESTAMP NOT NULL,
complete_dt TIMESTAMP NULL,
applied_by VARCHAR(100) NOT NULL,
description VARCHAR(500) NOT NULL
)

09/07/12                  http://coderinsights.blogspot.in   21
Database Migrations
• Delta scripts with do (up) & undo (down) parts
-- //
CREATE TABLE ‘post‘ (
‘title‘ VARCHAR(255),
‘time_created‘ DATETIME,
‘content‘ MEDIUMTEXT
);
-- //@UNDO
DROP TABLE ‘post‘;
-- //




09/07/12                   http://coderinsights.blogspot.in   22
Database Migrations
<dbdeploy
url="sqlite:test.db"
dir="deltas"
outputfile="deploy.sql"
undooutputfile="undo.sql"/>

<pdosqlexec
src="deploy.sql"
url="sqlite:test.db"/>

Buildfile: /home/pavan/dbdeploy/build.xml
Demo > migrate:
[dbdeploy] Getting applied changed numbers from DB:
mysql:host=localhost;dbname=demo
[dbdeploy] Current db revision: 0
[dbdeploy] Checkall:
[pdosqlexec] Executing file: /home/michiel/dbdeploy/deploy.sql
[pdosqlexec] 3 of 3 SQL statements executed successfully
BUILD FINISHED



09/07/12                                       http://coderinsights.blogspot.in   23
Database Migrations
-- Fragment begins: 1 --
INSERT INTO changelog
(change_number, delta_set, start_dt, applied_by, description)
VALUES (1, ’Main’, NOW(), ’dbdeploy’,
’1-create_initial_schema.sql’);
--//
CREATE TABLE ‘post‘ (
‘title‘ VARCHAR(255),
‘time_created‘ DATETIME,
‘content‘ MEDIUMTEXT
);
UPDATE changelog
SET complete_dt = NOW()
WHERE change_number = 1
AND delta_set = ’Main’;
-- Fragment ends: 1 --

09/07/12                        http://coderinsights.blogspot.in   24
Database Migrations
-- Fragment begins: 1 --
DROP TABLE ‘post‘;
--//
DELETE FROM changelog
WHERE change_number = 1
AND delta_set = ’Main’;
-- Fragment ends: 1 --




09/07/12                   http://coderinsights.blogspot.in   25
Phing Way




09/07/12   http://coderinsights.blogspot.in   26
Pitfalls
• Cleanup Deleted Source Files
      – Usually only a problem when you have * include
        patterns
• Undefined properties not raised as an error
• Little to no IDE support (Minimal support
  using Ant Plugin for Eclipse)



09/07/12              http://coderinsights.blogspot.in   27
More!!
SAMPLE
https://bitbucket.org/arnavawasthi/php-phing
WEBSITE
http://phing.info
MAILING LISTS
users@phing.tigris.org
dev@phing.tigris.org

09/07/12         http://coderinsights.blogspot.in   28

More Related Content

What's hot

Putting Phing to Work for You
Putting Phing to Work for YouPutting Phing to Work for You
Putting Phing to Work for You
hozn
 
Automated Deployment With Phing
Automated Deployment With PhingAutomated Deployment With Phing
Automated Deployment With Phing
Daniel Cousineau
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentBest Practices in PHP Application Deployment
Best Practices in PHP Application Deployment
Shahar Evron
 
11 tools for your PHP devops stack
11 tools for your PHP devops stack11 tools for your PHP devops stack
11 tools for your PHP devops stack
Kris Buytaert
 
Propel Your PHP Applications
Propel Your PHP ApplicationsPropel Your PHP Applications
Propel Your PHP Applications
hozn
 
Practical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsPractical PHP Deployment with Jenkins
Practical PHP Deployment with Jenkins
Adam Culp
 
Virtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 MayVirtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 May
Puppet
 
Zend Framework 1.8 workshop
Zend Framework 1.8 workshopZend Framework 1.8 workshop
Zend Framework 1.8 workshop
Nick Belhomme
 
Modulesync- How vox pupuli manages 133 modules, Tim Meusel
Modulesync- How vox pupuli manages 133 modules, Tim MeuselModulesync- How vox pupuli manages 133 modules, Tim Meusel
Modulesync- How vox pupuli manages 133 modules, Tim Meusel
Puppet
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016
Clark Everetts
 
Virtual Bolt Workshop - Dell - April 8 2020
Virtual Bolt Workshop - Dell - April 8 2020Virtual Bolt Workshop - Dell - April 8 2020
Virtual Bolt Workshop - Dell - April 8 2020
Puppet
 
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
Puppet
 
Vagrant move over, here is Docker
Vagrant move over, here is DockerVagrant move over, here is Docker
Vagrant move over, here is Docker
Nick Belhomme
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
Adam Englander
 
Easily Manage Patching and Application Updates with Chocolatey + Puppet - Apr...
Easily Manage Patching and Application Updates with Chocolatey + Puppet - Apr...Easily Manage Patching and Application Updates with Chocolatey + Puppet - Apr...
Easily Manage Patching and Application Updates with Chocolatey + Puppet - Apr...
Puppet
 
PHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBeneluxPHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBenelux
Nick Belhomme
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend development
sparkfabrik
 
Frequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last timeFrequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last timeAndreas Jung
 
Laravel 4 package development
Laravel 4 package developmentLaravel 4 package development
Laravel 4 package development
Tihomir Opačić
 
Getting started with Django 1.8
Getting started with Django 1.8Getting started with Django 1.8
Getting started with Django 1.8
rajkumar2011
 

What's hot (20)

Putting Phing to Work for You
Putting Phing to Work for YouPutting Phing to Work for You
Putting Phing to Work for You
 
Automated Deployment With Phing
Automated Deployment With PhingAutomated Deployment With Phing
Automated Deployment With Phing
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentBest Practices in PHP Application Deployment
Best Practices in PHP Application Deployment
 
11 tools for your PHP devops stack
11 tools for your PHP devops stack11 tools for your PHP devops stack
11 tools for your PHP devops stack
 
Propel Your PHP Applications
Propel Your PHP ApplicationsPropel Your PHP Applications
Propel Your PHP Applications
 
Practical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsPractical PHP Deployment with Jenkins
Practical PHP Deployment with Jenkins
 
Virtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 MayVirtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 May
 
Zend Framework 1.8 workshop
Zend Framework 1.8 workshopZend Framework 1.8 workshop
Zend Framework 1.8 workshop
 
Modulesync- How vox pupuli manages 133 modules, Tim Meusel
Modulesync- How vox pupuli manages 133 modules, Tim MeuselModulesync- How vox pupuli manages 133 modules, Tim Meusel
Modulesync- How vox pupuli manages 133 modules, Tim Meusel
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016
 
Virtual Bolt Workshop - Dell - April 8 2020
Virtual Bolt Workshop - Dell - April 8 2020Virtual Bolt Workshop - Dell - April 8 2020
Virtual Bolt Workshop - Dell - April 8 2020
 
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
 
Vagrant move over, here is Docker
Vagrant move over, here is DockerVagrant move over, here is Docker
Vagrant move over, here is Docker
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
 
Easily Manage Patching and Application Updates with Chocolatey + Puppet - Apr...
Easily Manage Patching and Application Updates with Chocolatey + Puppet - Apr...Easily Manage Patching and Application Updates with Chocolatey + Puppet - Apr...
Easily Manage Patching and Application Updates with Chocolatey + Puppet - Apr...
 
PHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBeneluxPHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBenelux
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend development
 
Frequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last timeFrequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last time
 
Laravel 4 package development
Laravel 4 package developmentLaravel 4 package development
Laravel 4 package development
 
Getting started with Django 1.8
Getting started with Django 1.8Getting started with Django 1.8
Getting started with Django 1.8
 

Viewers also liked

öZkan şAhin
öZkan şAhinöZkan şAhin
öZkan şAhinyardimt
 
Meat 2.0 vr7
Meat 2.0 vr7Meat 2.0 vr7
Meat 2.0 vr7
Mark Wilhelms
 
SöZcüKte Anlam
SöZcüKte AnlamSöZcüKte Anlam
SöZcüKte Anlamyardimt
 
Tugbapalta
TugbapaltaTugbapalta
Tugbapaltayardimt
 
CüMlenyn Yapisi
CüMlenyn YapisiCüMlenyn Yapisi
CüMlenyn Yapisiyardimt
 
Group Profile
Group ProfileGroup Profile
Group Profile
ajaybc
 
Fler Sunusu
Fler SunusuFler Sunusu
Fler Sunusuyardimt
 
Are you a life-long learner?
Are you a life-long learner?Are you a life-long learner?
Are you a life-long learner?
Jeremy Williams
 
「Rubyで描くビジネスモデル」池澤 一廣
「Rubyで描くビジネスモデル」池澤 一廣「Rubyで描くビジネスモデル」池澤 一廣
「Rubyで描くビジネスモデル」池澤 一廣toRuby
 
Economy in a nutshell
Economy in a nutshellEconomy in a nutshell
Economy in a nutshell
adam.onionomics
 
Art 245 photo montage
Art 245 photo montageArt 245 photo montage
Art 245 photo montage
Joseph DeLappe
 
Test First, Refresh Second: Web App TDD in Grails
Test First, Refresh Second: Web App TDD in GrailsTest First, Refresh Second: Web App TDD in Grails
Test First, Refresh Second: Web App TDD in Grails
Tim Berglund
 
Kelime Tuerleri
Kelime TuerleriKelime Tuerleri
Kelime Tuerleriyardimt
 
Hurricanes In Sandwich
Hurricanes In  SandwichHurricanes In  Sandwich
Hurricanes In SandwichLucyGauthier
 
Yapilarina GöRe Isimler
Yapilarina GöRe IsimlerYapilarina GöRe Isimler
Yapilarina GöRe Isimleryardimt
 
Steps to change address online.
Steps to change address online.Steps to change address online.
Steps to change address online.
Wassim Merheby
 
Increased FDI in defence manufacturing Press Note (7), 2014 series.
Increased FDI in defence manufacturing Press Note (7), 2014 series.Increased FDI in defence manufacturing Press Note (7), 2014 series.
Increased FDI in defence manufacturing Press Note (7), 2014 series.
Ankur Gupta
 
Mevlananin Ogutlari
Mevlananin OgutlariMevlananin Ogutlari
Mevlananin Ogutlariyardimt
 
大川祐介
大川祐介大川祐介
大川祐介
toRuby
 
Paragrafyn Yapysy
Paragrafyn YapysyParagrafyn Yapysy
Paragrafyn Yapysyyardimt
 

Viewers also liked (20)

öZkan şAhin
öZkan şAhinöZkan şAhin
öZkan şAhin
 
Meat 2.0 vr7
Meat 2.0 vr7Meat 2.0 vr7
Meat 2.0 vr7
 
SöZcüKte Anlam
SöZcüKte AnlamSöZcüKte Anlam
SöZcüKte Anlam
 
Tugbapalta
TugbapaltaTugbapalta
Tugbapalta
 
CüMlenyn Yapisi
CüMlenyn YapisiCüMlenyn Yapisi
CüMlenyn Yapisi
 
Group Profile
Group ProfileGroup Profile
Group Profile
 
Fler Sunusu
Fler SunusuFler Sunusu
Fler Sunusu
 
Are you a life-long learner?
Are you a life-long learner?Are you a life-long learner?
Are you a life-long learner?
 
「Rubyで描くビジネスモデル」池澤 一廣
「Rubyで描くビジネスモデル」池澤 一廣「Rubyで描くビジネスモデル」池澤 一廣
「Rubyで描くビジネスモデル」池澤 一廣
 
Economy in a nutshell
Economy in a nutshellEconomy in a nutshell
Economy in a nutshell
 
Art 245 photo montage
Art 245 photo montageArt 245 photo montage
Art 245 photo montage
 
Test First, Refresh Second: Web App TDD in Grails
Test First, Refresh Second: Web App TDD in GrailsTest First, Refresh Second: Web App TDD in Grails
Test First, Refresh Second: Web App TDD in Grails
 
Kelime Tuerleri
Kelime TuerleriKelime Tuerleri
Kelime Tuerleri
 
Hurricanes In Sandwich
Hurricanes In  SandwichHurricanes In  Sandwich
Hurricanes In Sandwich
 
Yapilarina GöRe Isimler
Yapilarina GöRe IsimlerYapilarina GöRe Isimler
Yapilarina GöRe Isimler
 
Steps to change address online.
Steps to change address online.Steps to change address online.
Steps to change address online.
 
Increased FDI in defence manufacturing Press Note (7), 2014 series.
Increased FDI in defence manufacturing Press Note (7), 2014 series.Increased FDI in defence manufacturing Press Note (7), 2014 series.
Increased FDI in defence manufacturing Press Note (7), 2014 series.
 
Mevlananin Ogutlari
Mevlananin OgutlariMevlananin Ogutlari
Mevlananin Ogutlari
 
大川祐介
大川祐介大川祐介
大川祐介
 
Paragrafyn Yapysy
Paragrafyn YapysyParagrafyn Yapysy
Paragrafyn Yapysy
 

Similar to Build Automation of PHP Applications

Intro to-ant
Intro to-antIntro to-ant
Intro to-ant
Manav Prasad
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...
Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...
Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...
buildacloud
 
Open writing-cloud-collab
Open writing-cloud-collabOpen writing-cloud-collab
Open writing-cloud-collabKaren Vuong
 
Django
DjangoDjango
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011Bachkoutou Toutou
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
Leo Lorieri
 
Apache ant
Apache antApache ant
Apache antkoniik
 
Take your database source code and data under control
Take your database source code and data under controlTake your database source code and data under control
Take your database source code and data under control
Marcin Przepiórowski
 
Documentation Insight技术架构与开发历程
Documentation Insight技术架构与开发历程Documentation Insight技术架构与开发历程
Documentation Insight技术架构与开发历程jeffz
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
Michelangelo van Dam
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
Kris Buytaert
 
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Phase2
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
Alfresco Software
 
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Codemotion
 
WorkFlow: An Inquiry Into Productivity by Timothy Bolton
WorkFlow:  An Inquiry Into Productivity by Timothy BoltonWorkFlow:  An Inquiry Into Productivity by Timothy Bolton
WorkFlow: An Inquiry Into Productivity by Timothy Bolton
Miva
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
Fabio Fumarola
 
XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the Basics
Ulrich Krause
 
Pure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talkPure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talk
Bryan Ollendyke
 

Similar to Build Automation of PHP Applications (20)

Write php deploy everywhere tek11
Write php deploy everywhere   tek11Write php deploy everywhere   tek11
Write php deploy everywhere tek11
 
Intro to-ant
Intro to-antIntro to-ant
Intro to-ant
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...
Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...
Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...
 
Open writing-cloud-collab
Open writing-cloud-collabOpen writing-cloud-collab
Open writing-cloud-collab
 
Django
DjangoDjango
Django
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Apache ant
Apache antApache ant
Apache ant
 
Take your database source code and data under control
Take your database source code and data under controlTake your database source code and data under control
Take your database source code and data under control
 
Documentation Insight技术架构与开发历程
Documentation Insight技术架构与开发历程Documentation Insight技术架构与开发历程
Documentation Insight技术架构与开发历程
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
 
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
 
WorkFlow: An Inquiry Into Productivity by Timothy Bolton
WorkFlow:  An Inquiry Into Productivity by Timothy BoltonWorkFlow:  An Inquiry Into Productivity by Timothy Bolton
WorkFlow: An Inquiry Into Productivity by Timothy Bolton
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the Basics
 
Pure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talkPure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talk
 

Recently uploaded

Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 

Recently uploaded (20)

Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 

Build Automation of PHP Applications

  • 1. Phing Automating PHP build deployment 09/07/12 http://coderinsights.blogspot.in 1
  • 2. Old Way 09/07/12 http://coderinsights.blogspot.in 2
  • 3. Why use Build Automation? “We are human, We get bored, We forget things, We make mistakes” • Improve product quality • Consolidate scripts • Eliminate repetitive tasks • Minimize error (bad builds) • Eliminate dependencies (Easier handover) • Highly extendible • Saves time 09/07/12 http://coderinsights.blogspot.in 3
  • 4. What is [PHing Is Not Gnumake] • It's a PHP project build tool based on Apache Ant • Opensource • Mostly Cross platform • Uses XML build files • No required external dependencies • Built & optimised for PHP5 09/07/12 http://coderinsights.blogspot.in 4
  • 5. What can you do? • Lots –Not just for deployment • SVN tasks • PHPUnit/SimpleTest • Code analysis tasks • PhpDocumentor • Zip/Unzip • File manipulation • Various OS tasks 09/07/12 http://coderinsights.blogspot.in 5
  • 6. Features 09/07/12 http://coderinsights.blogspot.in 6
  • 7. Phing Philosophy • Build scripts contains "Targets" – Targets should be small and specialized. – Example Targets: • clean – Clear temporary and cached files • copy – Copy files to their intended destination • migrate – Upgrade the database schema 09/07/12 http://coderinsights.blogspot.in 7
  • 8. Phing Philosophy • Targets can have dependencies – Target "live" can depend on clean, copy, and migrate – Meaning, when we run the "live" target, it first runs clean, copy, then migrate • And any tasks they depend on 09/07/12 http://coderinsights.blogspot.in 8
  • 9. Installing Phing • pear channel-discover pear.phing.info • pear install phing/Phing • Want all the dependencies? – pear config-set preferred_state alpha – pear install –alldeps phing/Phing – pear config-set preferred_state stable – pear install phing/phingdocs • Also available from: – SVN – Zip Download 09/07/12 http://coderinsights.blogspot.in 9
  • 10. Running Phing • $> phing –v – Lists Phing version • Phing expects to find a file "build.xml" in the current directory – build.xml defines the targets – You can use the "-f <filename>" flag to specify an alternate build file like • $> phing -f build-live.xml 09/07/12 http://coderinsights.blogspot.in 10
  • 11. Syntax • Build File uses XML • Standard Elements – Task: code that performs a specific function – Target: groups of tasks – Project: root node • Variables – ${variablename} – Conventions • Psuedo-Namespaces using periods • ${namespace.variable.name} 09/07/12 http://coderinsights.blogspot.in 11
  • 12. Basic Conventions • build.xml – Central repository of your top-level tasks • build-*.xml – Can be included into build.xml. – Usually for grouping by target (dev, staging,prod) or task (migrate, test, etc.) • build.properties – Technically an INI file that contains variables to be included by build files. 09/07/12 http://coderinsights.blogspot.in 12
  • 13. Basic build.xml <?xml version="1.0" encoding="UTF-8"?> <project name=“opx" default="default" basedir="."> <property file="build.properties" /> <target name="default"> <echo message="Hello World!" /> </target> </project> 09/07/12 http://coderinsights.blogspot.in 13
  • 14. Basic build.properties source.directory = /mnt/work/ ## Database Configuration db.user = username db.pass = password db.host = localhost db.name = database Usage: $phing –propertyfile build.properties 09/07/12 http://coderinsights.blogspot.in 14
  • 15. Most Useful Elements • Filesets: define once,use many <fileset id="src_crons" dir="${dir.crons_path}/statistic-engine/"> <include name="*.php"/> <exclude name="populate_opx_tables.php" /> </fileset> • Mappers & Filters: Transform files during copy/move/… <copy todir="${build}"> <fileset refid="files"/> <mapper type="glob" from="*.txt" to="*.new.txt"/> <filterchain> <replaceregexp> <regexp pattern="rn" replace="n"/> <expandproperties/> </replaceregexp> </filterchain> </copy> 09/07/12 http://coderinsights.blogspot.in 15
  • 16. Executing External Tools • Nearly all file transfer tools will be external commands • For this we need the Exec task <exec command="cp file1 file2" /> 09/07/12 http://coderinsights.blogspot.in 16
  • 17. Examples SVN, Git <svncopy username=“pavan“ password="test” repositoryurl="svn://localhost/phing/trunk/“ todir="svn://localhost/phing/tags/1.0"/> <svnexport repositoryurl="svn://localhost/project/trunk/” todir="/home/pavan/dev"/> <svnlastrevision repositoryurl="svn://localhost/project/trunk/” propertyname="lastrev"/> <echo>Last revision: ${lastrev}</echo> <svnlastrevision repositoryurl="${deploy.svn}” property="deploy.rev"/> <svnexport repositoryurl="${deploy.svn}" todir="/www/releases/build-${deploy.rev}"/> 09/07/12 http://coderinsights.blogspot.in 17
  • 18. Examples Packaging – Tar/Zip <tar compression="gzip" destFile="package.tgz" basedir="build"/> <zip destfile="htmlfiles.zip"> <fileset dir="."> <include name="**/*.html"/> </fileset> </zip> 09/07/12 http://coderinsights.blogspot.in 18
  • 19. Examples Documentation: – DocBlox – PhpDocumentor – ApiGen <docblox title="Phing API Documentation" output="docs" quiet="true"> <fileset dir="../../classes"> <include name="**/*.php"/> </fileset> </docblox> 09/07/12 http://coderinsights.blogspot.in 19
  • 20. Examples • SCP/FTP <scp username="john" password="smith" host="webserver" todir="/www/htdocs/project/"> <fileset dir="test"> <include name="*.html"/> </fileset> </scp> <ftpdeploy host="server01” username="john" password="smit" dir="/var/www"> <fileset dir="."> <include name="*.html"/> </fileset> </ftpdeploy> 09/07/12 http://coderinsights.blogspot.in 20
  • 21. Database Migrations • Set of delta SQL files (1-create-post.sql) • Tracks current version of your db in changelog table • Generates do and undo SQL files CREATE TABLE changelog ( change_number BIGINT NOT NULL, delta_set VARCHAR(10) NOT NULL, start_dt TIMESTAMP NOT NULL, complete_dt TIMESTAMP NULL, applied_by VARCHAR(100) NOT NULL, description VARCHAR(500) NOT NULL ) 09/07/12 http://coderinsights.blogspot.in 21
  • 22. Database Migrations • Delta scripts with do (up) & undo (down) parts -- // CREATE TABLE ‘post‘ ( ‘title‘ VARCHAR(255), ‘time_created‘ DATETIME, ‘content‘ MEDIUMTEXT ); -- //@UNDO DROP TABLE ‘post‘; -- // 09/07/12 http://coderinsights.blogspot.in 22
  • 23. Database Migrations <dbdeploy url="sqlite:test.db" dir="deltas" outputfile="deploy.sql" undooutputfile="undo.sql"/> <pdosqlexec src="deploy.sql" url="sqlite:test.db"/> Buildfile: /home/pavan/dbdeploy/build.xml Demo > migrate: [dbdeploy] Getting applied changed numbers from DB: mysql:host=localhost;dbname=demo [dbdeploy] Current db revision: 0 [dbdeploy] Checkall: [pdosqlexec] Executing file: /home/michiel/dbdeploy/deploy.sql [pdosqlexec] 3 of 3 SQL statements executed successfully BUILD FINISHED 09/07/12 http://coderinsights.blogspot.in 23
  • 24. Database Migrations -- Fragment begins: 1 -- INSERT INTO changelog (change_number, delta_set, start_dt, applied_by, description) VALUES (1, ’Main’, NOW(), ’dbdeploy’, ’1-create_initial_schema.sql’); --// CREATE TABLE ‘post‘ ( ‘title‘ VARCHAR(255), ‘time_created‘ DATETIME, ‘content‘ MEDIUMTEXT ); UPDATE changelog SET complete_dt = NOW() WHERE change_number = 1 AND delta_set = ’Main’; -- Fragment ends: 1 -- 09/07/12 http://coderinsights.blogspot.in 24
  • 25. Database Migrations -- Fragment begins: 1 -- DROP TABLE ‘post‘; --// DELETE FROM changelog WHERE change_number = 1 AND delta_set = ’Main’; -- Fragment ends: 1 -- 09/07/12 http://coderinsights.blogspot.in 25
  • 26. Phing Way 09/07/12 http://coderinsights.blogspot.in 26
  • 27. Pitfalls • Cleanup Deleted Source Files – Usually only a problem when you have * include patterns • Undefined properties not raised as an error • Little to no IDE support (Minimal support using Ant Plugin for Eclipse) 09/07/12 http://coderinsights.blogspot.in 27

Editor's Notes

  1. We are human We get bored We forget things We make mistakes Repetitive tasks like Versioncontrol (Unit)Testing Configuring Packaging Uploading DBchanges
  2. Phing is Recursive acronym In its simplest form, Phing allows you to copy code from your source control repository (SVN or Git) to your server via SSH, and perform pre and post-deploy functions like restarting a webserver, busting cache, renaming files, running database migrations and so on. With Phing it’s also possible to deploy to many machines at once. Original PHP4 version by Andreas Aderhold Cross-platform(for Windows) Build Systems Apache ANT Capastrano Plain PHP or BASH or BAT Files
  3. Interface to various popular (PHP)tools
  4. Introduced facade targets • Moved all the properties out • Used properties for configurability • Defined and reused elements with ids • Use of reflexives and replacements • Separating build files
  5. Optional documentation Pear install phing/phingdocs
  6. Other useful options: – Help (-h) – Specify properties (-D propname=value) – List targets (-l) – Get more output (-verbose or -debug)
  7. Task : code that performs a specific function (svncheckout, mkdir,etc.) Target : groups of tasks, can optionally depend on other targets Project : root node, contains multiple targets
  8. Mappers: Change filename Flatten directories Filters: Strip comments, whitespace Replace values Perform XSLT transformation Translation(i18n)