Questions tagged [phing]

Phing is a project build system based on Apache ant. You can do anything with Phing that you could do with a traditional build system like Gnu make, and Phing's use of simple XML build files and extensible PHP "task" classes make it an easy-to-use and highly flexible build framework.

Phing is a project build system based on Apache ant. You can do anything with Phing that you could do with a traditional build system like Gnu make, and Phing's use of simple XML build files and extensible PHP "task" classes make it an easy-to-use and highly flexible build framework. Phing comes packaged with numerous out-of-the-box operation modules (tasks), and an easy-to-use OO model for adding your own custom tasks. (copied from the Phing documentation)

Phing provides the following features:

  • Simple XML buildfiles
  • Rich set of provided tasks
  • Easily extendable via PHP classes
  • Platform-independent: works on UNIX, Windows, MacOSX
  • No required external dependencies
  • Built & optimized for ZendEngine2/PHP5

Useful resources:

Hello World Example

Contents of build.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project name="HelloWorld" default="world" basedir=".">
    <target name="world" depends="message">
        <echo message="World!" />
    </target>
    <target name="message">
        <echo message="Hello, " />
    </target>
</project>

Executed by running phing or phing world

$ phing world
Buildfile: /tmp/phingtest/build.xml

HelloWorld > message:

     [echo] Hello, 

HelloWorld > world:

     [echo] World!

BUILD FINISHED

Total time: 0.0940 seconds

Installing via Composer

{
    "require": {
        "phing/phing": "2.5.0"
    },
}
384 questions
202
votes
9 answers

Setting up a deployment / build / CI cycle for PHP projects

I am a lone developer most of my time, working on a number of big, mainly PHP-based projects. I want to professionalize and automate how changes to the code base are handled, and create a Continuous Integration process that makes the transition to…
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
31
votes
2 answers

Phing and Composer, which way around?

I want to use both Phing and Composer for my applications. Phing as the build system and Composer to manage dependencies. But which way around should they be used? Currently we're installing Phing globally on all servers. Phing is supposed to…
25
votes
5 answers

Do you use Phing?

Does anyone use Phing to deploy PHP applications, and if so how do you use it? We currently have a hand-written "setup" script that we run whenever we deploy a new instance of our project. We just check out from SVN and run it. It sets some basic…
Sam McAfee
  • 10,057
  • 15
  • 60
  • 64
24
votes
2 answers

what can Phing do that Ant can't?

I'm doing PHP development and I'm thinking of using one of these. I have both PHP and Java installed on my machine. In theory I could use any of the two. What are the compelling arguments to pick Phing over Ant?
Michael Ekoka
  • 19,050
  • 12
  • 78
  • 79
22
votes
4 answers

How To Deploy Your PHP Applications Correctly?

How to correctly deploy applications from development to production and how to deal with multiple site configurations. All my development are done thru SVN located at var/svn/myapp/trunk and the actual production code is in /var/www/myapp. I check…
ocptime
  • 281
  • 1
  • 3
  • 5
19
votes
4 answers

PHP build/integration tools: Do you use them?

After reading the "Modern PHP workflow" article in the November 2008 edition of php|architect magazine which discussed unit testing (phpUnit), build tools (Phing) and continuous integration (Xinc), I'm inspired the learn more about some of the…
Jim OHalloran
  • 5,859
  • 2
  • 37
  • 57
17
votes
2 answers

travis-ci script

I'm trying to setup phing to work with travis-ci, but I can't get it to run a setup script to get all the dependencies installed. My .travis.yml file is: language: php php: - 5.2 script: ./.travis-phing.sh In travis, I get the…
Genu
  • 1,094
  • 1
  • 9
  • 22
16
votes
6 answers

find replace text in file with Phing

Does anyone know how to find and replace text inside a file with Phing?
milan
  • 2,179
  • 9
  • 24
  • 34
15
votes
2 answers

How to group targets in Phing?

Is there a way to group targets in Phing? I have a number of targets that can be reused by running them in different orders and combinations. For example to create a new dev build: $ phing clean $ phing prepare $ phing build $ phing runtests Or to…
t j
  • 7,026
  • 12
  • 46
  • 66
15
votes
1 answer

How to provide a password for PostgreSQL's createdb non-interactively?

I have a task in phing where before tests I drop the database if exists and create it. This is run on Jenkins. I want to do it with createdb like this: The thing is that the createdb is asking me to…
karolsojko
  • 711
  • 1
  • 8
  • 27
14
votes
3 answers

How to return a value from a phing target?

I would like to have a foreach task like this, which iterates over all the files/directories in a directory "A" -
Sandeepan Nath
  • 9,966
  • 17
  • 86
  • 144
10
votes
3 answers

How to hide some phing targets from xml

i have about 25 phing targets, when i list them in the console. But 5 of them are just needed by other targets and i will never trigger them alone. is there a possibility to hide them? For example: There are the targets: cms.cc …
OskarStark
  • 384
  • 1
  • 11
10
votes
1 answer

Echo linebreak to file using Phing on Windows

In my build script I'm trying to output the date and SVN revision number to a file in the build directory. I would like the date and revision number on separate line, but can't get a linebreak to output to the file. I've tried all sorts of…
ChrisA
  • 2,091
  • 1
  • 14
  • 23
10
votes
2 answers

How to generate changelog: git log since last Hudson build?

I'm using Phing to do post build tasks in Hudson. I want to generate changelog containing all commits since last successful Hudson build. But looks like neither Hudson nor Git plugin for Hudson does not provide %last_build_time% variable. This would…
takeshin
  • 49,108
  • 32
  • 120
  • 164
10
votes
4 answers

Phing and composer

we use phing to build and test our project. I want to remove dependencies on PEAR as much as possible so I can run different versions of packages for different projects. I have created a composer.json file which install all the necessary packages { …
Martijn de Munnik
  • 924
  • 12
  • 23
1
2 3
25 26