Classes, interfaces and traits

AdhocTask

Abstract class for creating adhoc Phing components in buildfile.

By itself this class can be used to declare a single class within your buildfile. You can then reference this class in any task that takes custom classes (selectors, mappers, filters, etc.) Subclasses exist for conveniently declaring and registering tasks and types.
« More »

AdhocTaskdefTask

A class for creating adhoc tasks in build file.

<target name="test-adhoc"> <adhoc-task name="foo"><![CDATA[ class FooTest extends Task { private $bar; function setBar($bar) { $this->bar = $bar; } function main() { $this->log("In FooTest: " . $this->bar); } } ]]></adhoc-task> <foo bar="B.L.I.N.G"/> </target>
« More »

AdhocTypedefTask

A class for creating adhoc datatypes in build file.

By itself this class can be used to declare a single class within your buildfile. You can then reference this class in any task that takes custom classes (selectors, mappers, filters, etc.) Subclasses exist for conveniently declaring and registering tasks and types.
« More »

AppendTask

Appends text, contents of a file or set of files defined by a filelist to a destination file.

<code> <append text="And another thing\n" destfile="badthings.log"/> </code> OR <code> <append file="header.html" destfile="fullpage.html"/> <append file="body.html" destfile="fullpage.html"/> <append file="footer.html" destfile="fullpage.html"/> </code> OR <code> <append destfile="${process.outputfile}"> <filterchain> <xsltfilter style="${process.stylesheet}"> <param name="mode" expression="${process.xslt.mode}"/> <param name="file_name" expression="%{task.append.current_file.basename}"/> <!-- Example of using a RegisterSlot variable --> </xsltfilter> </filterchain> <filelist dir="book/" listfile="book/PhingGuide.book"/> </append> </code>
« More »

ApplyTask

Executes a command on the (filtered) file list/set.

(Loosely based on the "Ant Apply" task - http://ant.apache.org/manual/Tasks/apply.html)
« More »

AvailableTask

<available> task.

Note: implements condition interface (see condition/Condition.php)
« More »

ChmodTask

Task that changes the permissions on a file/directory.

Use \Project#createTask to register a new Task.
« More »

ChownTask

Task that changes the permissions on a file/directory.

Use \Project#createTask to register a new Task.
« More »

ConditionTask

<condition> task as a generalization of <available>

<p>This task supports boolean logic as well as pluggable conditions to decide, whether a property should be set.</p> <p>This task does not extend Task to take advantage of ConditionBase.</p>
« More »

CopyTask

A phing copy task. Copies a file or directory to a new file or directory. Files are only copied if the source file is newer than the destination file, or when the destination file does not exist. It is possible to explictly overwrite existing files.

Use \Project#createTask to register a new Task.
« More »

CreoleTask

Handles Creole configuration needed by SQL type tasks.

Use \Project#createTask to register a new Task.
« More »

CVSPassTask

Adds an new entry to a CVS password file.

Use \Project#createTask to register a new Task.
« More »

CvsTask

Task for performing CVS operations.

NOTE: This implementation has been moved here from Cvs.java with the addition of some accessors for extensibility. Another task can extend this with some customized output processing.
« More »

DeleteTask

Deletes a file or directory, or set of files defined by a fileset.

Use \Project#createTask to register a new Task.
« More »

EchoTask

Echos a message to the logging system or to a file

Use \Project#createTask to register a new Task.
« More »

ElseIfTask

"Inner" class for IfTask.

This class has same basic structure as the IfTask, although of course it doesn't support <else> tags.
« More »

ExecTask

Executes a command on the shell.

Use \Project#createTask to register a new Task.
« More »

FailTask

Exits the active build, giving an additional message if available.

Use \Project#createTask to register a new Task.
« More »

ForeachTask

<foreach> task

Task definition for the foreach task. This task takes a list with delimited values, and executes a target with set param. Usage: <foreach list="values" target="targ" param="name" delimiter="|" /> Attributes: list --> The list of values to process, with the delimiter character, indicated by the "delimiter" attribute, separating each value. target --> The target to call for each token, passing the token as the parameter with the name indicated by the "param" attribute. param --> The name of the parameter to pass the tokens in as to the target. delimiter --> The delimiter string that separates the values in the "list" parameter. The default is ",".
« More »

FunctionParam

Supports the <param> nested tag for PhpTask.

« More »

IfTask

Perform some tasks based on whether a given condition holds true or not.

<p>This task is heavily based on the Condition framework that can be found in Ant 1.4 and later, therefore it cannot be used in conjunction with versions of Ant prior to 1.4.</p> <p>This task doesn't have any attributes, the condition to test is specified by a nested element - see the documentation of your <code><condition&gt;</code> task (see <a href="http://jakarta.apache.org/ant/manual/CoreTasks/condition.html">the online documentation</a> for example) for a complete list of nested elements.</p> <p>Just like the <code><condition&gt;</code> task, only a single condition can be specified - you combine them using <code><and&gt;</code> or <code><or&gt;</code> conditions.</p> <p>In addition to the condition, you can specify three different child elements, <code><elseif&gt;</code>, <code><then&gt;</code> and <code><else&gt;</code>. All three subelements are optional. Both <code><then&gt;</code> and <code><else&gt;</code> must not be used more than once inside the if task. Both are containers for Ant tasks, just like Ant's <code><parallel&gt;</code> and <code><sequential&gt;</code> tasks - in fact they are implemented using the same class as Ant's <code><sequential&gt;</code> task.</p> The <code><elseif&gt;</code> behaves exactly like an <code><if&gt;</code> except that it cannot contain the <code><else&gt;</code> element inside of it. You may specify as may of these as you like, and the order they are specified is the order they are evaluated in. If the condition on the <code><if&gt;</code> is false, then the first <code><elseif&gt;</code> who's conditional evaluates to true will be executed. The <code><else&gt;</code> will be executed only if the <code><if&gt;</code> and all <code><elseif&gt;</code> conditions are false. <p>Use the following task to define the <code><if&gt;</code> task before you use it the first time:</p> <pre><code> &lt;taskdef name=&quot;if&quot; classname=&quot;net.sf.antcontrib.logic.IfTask&quot; /&gt; </code></pre> <h3>Crude Example</h3> <code> <if> <equals arg1="${foo}" arg2="bar" /> <then> <echo message="The value of property foo is bar" /> </then> <else> <echo message="The value of property foo is not bar" /> </else> </if> </code> <code> <if> <equals arg1="${foo}" arg2="bar" /&gt; <then> <echo message="The value of property foo is 'bar'" /> </then> <elseif> <equals arg1="${foo}" arg2="foo" /> <then> <echo message="The value of property foo is 'foo'" /> </then> </elseif> <else> <echo message="The value of property foo is not 'foo' or 'bar'" /> </else> </if> </code>
« More »

ImportTask

Imports another build file into the current project.

Targets and properties of the imported file can be overrridden by targets and properties of the same name declared in the importing file. The imported file will have a new synthetic property of "phing.file.<projectname>" declared which gives the full path to the imported file. Additionally each target in the imported file will be declared twice: once with the normal name and once with "<projectname>." prepended. The "<projectname>.<targetname>" synthetic targets allow the importing file a mechanism to call the imported files targets as dependencies or via the <phing> or <phingcall> task mechanisms.
« More »

IncludePathTask

Adds a normalized path to the PHP include_path.

This provides a way to alter the include_path without editing any global php.ini settings or PHP_CLASSPATH environment variable. <code> <includepath classpath="new/path/here"/> </code>
« More »

InputTask

Reads input from the InputHandler.

Use \Project#createTask to register a new Task.
« More »

MatchingTask

This is an abstract task that should be used by all those tasks that require to include or exclude files based on pattern matching.

This is very closely based on the ANT class of the same name.
« More »

MkdirTask

Task to create a directory.

Use \Project#createTask to register a new Task.
« More »

MoveTask

Moves a file or directory to a new file or directory.

By default, the destination file is overwritten if it already exists. When overwrite is turned off, then files are only moved if the source file is newer than the destination file, or when the destination file does not exist. Source files and directories are only deleted when the file or directory has been copied to the destination successfully.
« More »

PDOTask

Handles PDO configuration needed by SQL type tasks.

Use \Project#createTask to register a new Task.
« More »

PhingCallTask

Call another target in the same project.

<samp> <target name="foo"> <phingcall target="bar"> <property name="property1" value="aaaaa" /> <property name="foo" value="baz" /> </phingcall> </target> <target name="bar" depends="init"> <echo message="prop is ${property1} ${foo}" /> </target> </samp> This only works as expected if neither property1 nor foo are defined in the project itself.
« More »

PhingReference

Helper class that implements the nested <reference> element of <phing> and <phingcall>.

« More »

PhingTask

Task that invokes phing on another build file.

Use this task, for example, if you have nested buildfiles in your project. Unlike AntTask, PhingTask can even support filesets: <pre> <phing> <fileset dir="${srcdir}"> <include name="** /build.xml" /> <!-- space added after ** is there because of PHP comment syntax --> <exclude name="build.xml" /> </fileset> </phing> </pre>
« More »

PhpEvalTask

Executes PHP function or evaluates expression and sets return value to a property.

WARNING: This task can, of course, be abused with devastating effects. E.g. do not modify internal Phing classes unless you know what you are doing.
« More »

PropertyPromptTask

Deprecated task that uses console to prompt user for property values.

This class is very slightly simpler than the InputTask, but lacks the ability to use a non-console input handler. You should, therefore, use InputTask. This class can serve as a reference, but will be removed in the future.
« More »

PropertyTask

Task for setting properties in buildfiles.

Use \Project#createTask to register a new Task.
« More »

ReflexiveTask

This task is for using filter chains to make changes to files and overwrite the original files.

This task was created to serve the need for "cleanup" tasks -- e.g. a ReplaceRegexp task or strip task being used to modify files and then overwrite the modified files. In many (most?) cases you probably should just use a copy task to preserve the original source files, but this task supports situations where there is no src vs. build directory, and modifying source files is actually desired. <code> <reflexive> <fileset dir="."> <include pattern="*.html"> </fileset> <filterchain> <replaceregexp> <regexp pattern="\n\r" replace="\n"/> </replaceregexp> </filterchain> </reflexive> </code>
« More »

ReplaceRegexpTask

ReplaceRegExp is a directory based task for replacing the occurrence of a given regular expression with a substitution pattern in a selected file or set of files.

<code> <replaceregexp file="${src}/build.properties" match="OldProperty=(.*)" replace="NewProperty=\1" byline="true"/> </code>
« More »

ResolvePathTask

Task for resolving relative paths and setting absolute path in property value.

This task was created to address a need for resolving absolute paths of files / directories. In many cases a relative directory (e.g. "./build") is specified, but it needs to be treated as an absolute path since other build files (e.g. in subdirs) should all be using the same path -- and not treating it as a relative path to their own directory. <code> <property name="relative_path" value="./dirname"/> <resolvepath propertyName="absolute_path" file="${relative_path}"/> <echo>Resolved [absolute] path: ${absolute_path}</echo> </code> TODO: - Possibly integrate this with PackageAsPath, for handling/resolving dot-path paths.
« More »

SequentialTask

Sequential is a container task that contains other Phing Task objects.

The sequential task has no attributes and does not support any nested elements apart from Ant tasks. Any valid Ant task may be embedded within the sequential task.
« More »

TaskdefTask

Register a task for use within a buildfile.

This is for registering your own tasks -- or any non-core Task -- for use within a buildfile. If you find that you are using a particular class frequently, you may want to edit the phing/tasks/defaults.properties file so that it is included by default. You may also want to submit it (if LGPL or compatible license) to be included in Phing distribution. <pre> <taskdef name="mytag" classname="path.to.MyHandlingClass"/> . . <mytag param1="val1" param2="val2"/> </pre> TODO: -- possibly refactor since this is almost the same as TypeDefTask (right now these are just too simple to really justify creating an abstract class)
« More »

TouchTask

Touch a file and/or fileset(s); corresponds to the Unix touch command.

If the file to touch doesn't exist, an empty one is created.
« More »

TryCatchTask

A wrapper task that lets you run tasks(s) when another set of tasks fails.

Inspired by [http://ant-contrib.sourceforge.net/tasks/tasks/trycatch.html](http://ant-contrib.sourceforge.net/tasks/tasks/trycatch.html)
« More »

TstampCustomFormat

« More »

TstampTask

Sets properties to the current time, or offsets from the current time.

The default properties are TSTAMP, DSTAMP and TODAY; Based on Ant's Tstamp task.
« More »

TypedefTask

Register a datatype for use within a buildfile.

This is for registering your own datatypes for use within a buildfile. If you find that you are using a particular class frequently, you may want to edit the phing/types/defaults.properties file so that it is included by default. You may also want to submit it (if LGPL or compatible license) to be included in Phing distribution. <pre> <typedef name="mytype" classname="path.to.MyHandlingClass"/> . <sometask ...> <mytype param1="val1" param2="val2"/> </sometask> </pre> TODO: -- possibly refactor since this is almost the same as TaskDefTask (right now these are just too simple to really justify creating an abstract class)
« More »

UpToDateTask

Sets the given property if the specified target has a timestamp greater than all of the source files.

Use \Project#createTask to register a new Task.
« More »

WaitForTask

Based on Apache Ant Wait For:

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
« More »

WarnTask

Simple task to echo a warning message (Project::MSG_WARN) to all output devices.

Use \Project#createTask to register a new Task.
« More »

XsltTask

Implements an XSLT processing filter while copying files.

This is a shortcut for calling the <copy> task with the XSLTFilter used in the <filterchains> section.
« More »