<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbookxi.rng" 
            schematypens="http://relaxng.org/ns/structure/1.0"?>
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="ch.introduction">
    <title>Introduction</title>
    <sect1>
        <title>What Phing Is</title>
        <para><acronym>Phing</acronym> is a project build system based on Apache ant (See <xref
                xlink:href="#ant" xlink:title="[ant]"/>). You can do anything with
                <acronym>Phing</acronym> that you could do with a traditional build system like Gnu
            make (See <xref xlink:href="#gnumake" xlink:title="[gmake]"/>), and 
            <acronym>Phing's</acronym> use of
            simple XML build files and extensible PHP task classes make it an easy-to-use and highly
            flexible build framework.</para>
        <para>Because <acronym>Phing</acronym> is based on Ant, parts of this manual are also
            adapted from the ant manual (see <xref xlink:href="#ant" xlink:title="[ant]"/>). We are
            extremely grateful to the folks in the Ant project for creating (and continuing to
            create) such an inspiring build system model, and for the open-source licensing that
            makes it possible for us to learn from each other and build increasingly better tools.</para>
    </sect1>
    <sect1>
        <title>Phing &amp; Binarycloud: History</title>
        <para><acronym>Phing</acronym> was originally a subproject of Binarycloud. Binarycloud is a
            highly engineered application framework, designed for use in enterprise environments.
            Binarycloud uses XML extensively for storing metadata about a project (configuration,
            nodes, widgets, site structure, etc.). Because Binarycloud is built for PHP, performing
            extensive XML processing and transformations on each page request is an unrealistic
            proposition. Phing is used to &quot;compile&quot; the XML metadata into PHP arrays that
            can be processed without overhead by PHP scripts.</para>
        <para>Of course, XML compilation is only one of many ways that Binarycloud uses the
                <acronym>Phing</acronym> build system. The <acronym>Phing</acronym> build system
            makes it possible for you to:</para>
        <itemizedlist>
            <listitem>
                <para>Build multi language pages from one source tree,</para>
            </listitem>
            <listitem>
                <para>Centralize metadata (e.g. your data model) in one XML file and generate
                    several files from that XML with different XSLT.</para>
            </listitem>
        </itemizedlist>
        <para>It the beginning, Binarycloud used the GNU make system; however, this approach had
            some drawbacks: The space-before-tab-problem in makefiles, the fact that it is only
            natively available for Unix systems etc. So, the need for a better build system arose.
            Apache Ant was a logical choice -- do to its use of XML build files and modular design.
            The problem was that Ant is written in Java, so you need to install a JVM on your
            computer to use it. Besides the need for yet another interpreter (i.e. besides PHP),
            there was also legal/ideological conflict in requiring a commercial JVM (there were
            problems with Ant on JVMs other than Sun's) for an LGPL'd Binarycloud.</para>
        <para>So, the development of <acronym>Phing</acronym> began. <acronym>Phing</acronym> is a
            build system written in PHP and uses the ideas of Ant. The first release was designed
            &amp; developed simultaneously, and thus not very sophisticated. This original system
            was quickly pushed to its limits and the need for a better Phing became a priority.
            Andreas Aderhold, who was responsible for <acronym>Phing</acronym>/r1, designed and
            wrote much of the Phing/r2 that followed. Phing/r2 became the Phing-1.0 that exists
            today for PHP4.</para>
        <para>The current development version of <acronym>Phing 2.x</acronym>, requires
                <acronym>PHP5</acronym> (at least 5.2.x) and makes use of many of the available
            features in PHP5.2 to achieve a high degree of modularization, code efficiency as well
            as stability and testability.</para>
    </sect1>
    <sect1>
        <title>How Phing Works</title>
        <para><acronym>Phing</acronym> uses XML buildfiles that contain a description of the things
            to do. The buildfile is structured into targets that contain the actual commands to
            perform (e.g. commands to copy a file, delete a directory, perform a DB query, etc.).
            So, to use <acronym>Phing</acronym>, you would first write your buildfile and then you
            would run phing, specifying the target in your buildfile that you want to execute.</para>
        <screen>% phing -f mybuildfile.xml mytarget</screen>
        <para>By default <acronym>Phing</acronym> will look for a buildfile named
                <filename>build.xml</filename> (so you don't have to specify the buildfile name
            unless it is not <filename>build.xml</filename>) and if no target is specified
                <acronym>Phing</acronym> will try to execute the default target, as specified in the
                <literal>&lt;project></literal> tag.</para>
        <para>In the same way as traditional make files (but without most of the traditional
            drawbacks) targets can have dependencies. They can depend on both other targets as well
            as other files. </para>
    </sect1>
    <sect1>
        <title>Cool, so how can I help?</title>
        <para><acronym>Phing</acronym> is under active development and there are many things to be
            done. The project will also welcome non-coders to help keep the documentation up to
            date. If you don't already know about DocBook participåating in the documentation is a
            great opportunity to get experience! </para>
        <para>To get involved start by doing the following:</para>
        <itemizedlist>
            <listitem>
                <para>Read this manual to get a high level understanding of <acronym>Phing</acronym>
                    ;-)</para>
            </listitem>
            <listitem>
                <para>Read the <link xlink:href="http://www.phing.info/trac/wiki">Phing Wiki</link>
                    to catch up with the latest news</para>
            </listitem>
            <listitem>
                <para>Go to <link xlink:href="http://phing.tigris.org"
                        >http://phing.tigris.org</link> and subscribe to the <literal>Phing
                        dev</literal> mailing list (this is usually a low volume, high quality
                    mailing list)</para>
            </listitem>
            <listitem>
                <para>Report bugs you find in  Phing on the <link xlink:href="http://trac.edgewall.org/"
                        >Trac</link> wiki and defect reporting system available at <link
                        xlink:href="http://www.phing.info/trac/"
                    >http://www.phing.info/trac/</link></para>
            </listitem>
            <listitem>
                <para>... and of course, start to actively participate in the development by forking
                    the repository (see below) </para>
            </listitem>
        </itemizedlist>
        <sect2>
            <title> Participating in the development </title>
            
            <para>As of 1 January 2012 all Phing development is based on Git and the project is
                hosted at GitHub (<link xlink:href="https://github.com/"
                >https://github.com/</link>)</para>
            <para>In order to participate in the development you will only need to follow three
                basic steps</para>
            <orderedlist>
                <listitem>
                    <para>Register a free account at <link xlink:href="https://github.com/"
                            >GitHub</link></para>
                </listitem>
                <listitem>
                    <para>Clone the <link xlink:href="https://github.com/phingofficial/phing"
                            >Official Git repository</link>
                    </para>
                </listitem>
                <listitem>
                    <para>Read up on the (very well written) documentation at GitHub on how to setup
                        your own repository and do things like cloning an existing repository and
                        creating pull requests asking the official Phing maintainers to take in your
                        proposed additions/changes. </para>
                </listitem>
            </orderedlist>
            <para>The chances to have a change set accepted greatly increases if you adhere to the
                following recommendations</para>
            <itemizedlist>
                <listitem>
                    <para>Follow the naming and coding principle used by Phing</para>
                </listitem>
                <listitem>
                    <para>Make sure you have added documentation for your addition(s), including
                        examples.</para>
                </listitem>
                <listitem>
                    <para>Make sure you have added unit-test code as needed</para>
                </listitem>
                <listitem>
                    <para>Be polite in all communication!</para>
                </listitem>
            </itemizedlist>
            <para>
                <note>
                    <para>If you have not worked with Git before and are coming from subversion
                        there is a bit of re-adjustment needed. Fortunately there are several
                            <emphasis>SVN-To-Git</emphasis> re-learning guides available (for
                        example <link xlink:href="http://git.or.cz/course/svn.html"
                            >http://git.or.cz/course/svn.html</link> which might make the initial
                        transition easier.</para>
                    <para>However, it is probably best to forget about your mental picture on
                        Subversion and realize that Git is a different animal. So trying to think of
                        everything in terms of Subversion is not really helpful in the long run. You
                        should therefore take the time to read the (free!) book "Pro Git", by Scott
                        Chacon available from  <link xlink:href="http://progit.org/"
                            >http://progit.org/</link>. </para>
                </note>
            </para>
        </sect2>        
    </sect1>

</chapter>
