cvs: peardoc /en/package/php/php-uml api.xml command-line.xml conversion-rules.xml intro.xml
| From: | Baptiste Autin | Date: | Sun, 04 Jan 2009 21:55:56 +0000 |
| Subject: | cvs: peardoc /en/package/php/php-uml api.xml command-line.xml conversion-rules.xml intro.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-11420@lists.php.net to get a copy of this message | ||
baptiste750 Sun Jan 4 21:55:56 2009 UTC
Added files:
/peardoc/en/package/php/php-uml api.xml command-line.xml
Modified files:
/peardoc/en/package/php/php-uml conversion-rules.xml intro.xml
Log:
Added documentation for the release 0.5.0 of PHP_UML
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-uml/conversion-rules.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/package/php/php-uml/conversion-rules.xml diff -u peardoc/en/package/php/php-uml/conversion-rules.xml:1.3 peardoc/en/package/php/php-uml/conversion-rules.xml:1.4 --- peardoc/en/package/php/php-uml/conversion-rules.xml:1.3 Thu Oct 9 15:16:48 2008 +++ peardoc/en/package/php/php-uml/conversion-rules.xml Sun Jan 4 21:55:56 2009 @@ -2,7 +2,7 @@ <refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.php.php-uml.conversion-rules"> <refnamediv> <refname>Conversion rules</refname> - <refpurpose>How do PHP elements map to UML?</refpurpose> + <refpurpose>How do PHP elements map to UML concepts?</refpurpose> </refnamediv> <refsection><info><title>Logical view</title></info> @@ -27,14 +27,14 @@ <itemizedlist> <listitem> <simpara> - by using the docblock <literal>@package</literal> in the comment of a class (or of a file) + by using the PHP <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.php.net/manual/en/language.namespaces.php">namespace</link> instruction </simpara> <simpara> - by interpreting the namespace of a class + by using the docblock <literal>@package</literal> in the comment of a class (or of a file) </simpara> </listitem> </itemizedlist> - In the latter case, <classname>PHP_UML</classname> understands the double-colon <literal>::</literal> as the package delimiter. This works in conjunction with the PHP namespacing instructions (<literal>namespace</literal> and <literal>use</literal>). + Note that the <literal>namespace</literal> and <literal>use</literal> instructions will be parsed only if you run PHP_UML with PHP from version 5.3. </para> </refsection> @@ -60,10 +60,10 @@ <itemizedlist> <listitem> <simpara> - A PHP file maps to an UML Component. + A class (or an interface) maps to an UML Component. </simpara> <simpara> - A physical folder maps to an UML Subpackage. + A logical package maps to an UML Subpackage. </simpara> </listitem> </itemizedlist> @@ -73,10 +73,10 @@ <itemizedlist> <listitem> <simpara> - A PHP file maps to an UML Component. + A class (or an interface) maps to an UML Component. </simpara> <simpara> - A physical folder maps to a nesting UML Component. + A logical package maps to a nesting UML Component. </simpara> </listitem> </itemizedlist> http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-uml/intro.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/package/php/php-uml/intro.xml diff -u peardoc/en/package/php/php-uml/intro.xml:1.3 peardoc/en/package/php/php-uml/intro.xml:1.4 --- peardoc/en/package/php/php-uml/intro.xml:1.3 Thu Oct 9 15:16:48 2008 +++ peardoc/en/package/php/php-uml/intro.xml Sun Jan 4 21:55:56 2009 @@ -4,44 +4,60 @@ <refname>Introduction</refname> <refpurpose>Purpose and simple usage example</refpurpose> </refnamediv> + <refsection><info><title>Description</title></info> - <para> <classname>PHP_UML</classname> is a reverse-engineering tool, and a documentation tool. </para> <para> - It parses PHP files and directories, and generates an XMI file corresponding to the parsed code. + It can parse PHP files and directories, and generate: + </para> + <para> + <itemizedlist> + <listitem> + <simpara> + A XMI file, reflecting the object structure of the code parsed + </simpara> + <simpara> + A full HTML API documentation, very similar to <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://java.sun.com/j2se/javadoc/reference/docs/">Javadoc</link> + </simpara> + <simpara> + PHP code skeletons (useful if you have an existing XMI file, and want to generate the files, folders and class declarations all at once) + </simpara> + </listitem> + </itemizedlist> </para> <para> - XMI is an <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.omg.org/">OMG</link> standard for exchanging metadata information via XML, and is commonly used as an interchange format for UML models. Many UML softwares support importing and exporting of XMI files. + <emphasis>XMI</emphasis> is an <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.omg.org/">OMG</link> standard for exchanging metadata information via XML, and is commonly used as an interchange format for UML models. Many UML softwares support importing and exporting of XMI files. </para> </refsection> + <refsection><info><title>Features</title></info> - <para> - Like <link linkend="package.php.phpdocumentor">PhpDocumentor</link>, <classname>PHP_UML</classname> can parse the following PHP elements: classes, interfaces, properties, and functions. It can also retrieve information from the inline comments, via the docblocks: <literal>@package</literal>, <literal>@var</literal>, <literal>@param</literal> + Like <link linkend="package.php.phpdocumentor">PhpDocumentor</link>, <classname>PHP_UML</classname> can parse the following PHP elements: namespaces, classes, interfaces, properties, and functions. It can also retrieve information from the inline comments, via the docblocks: <literal>@package</literal>, <literal>@var</literal>, <literal>@param</literal> <itemizedlist> <listitem> <simpara> <literal>@param</literal> and <literal>@var</literal> learn PHP_UML about the expected types of a parameter or a property. </simpara> <simpara> - <literal>@package</literal> learns PHP_UML about the nesting package of an element. + <literal>@package</literal> learns PHP_UML about the namespace of an element (even if, from PHP 5.3, it is recommended to use the PHP namespacing instructions instead) </simpara> </listitem> </itemizedlist> </para> <para> - So the more documented your PHP code is, the more precise your XMI file will be. + So the more documented your PHP code is, the more precise your XMI file, or your API documentation, will be. </para> <para> - At the current time, the UML/XMI standard exist in two different versions, 1.4 and 2.1. PHP_UML can generate XMI in both versions. Be warned, though, that some UML tools might not render well this or that aspect of your XMI file. For example, the link between an UML artifact (i.e. a source file) and the logical elements defined in the artifact is only available in version 2 of UML. + At the current time, the UML/XMI standards exist in two different versions, 1.4 and 2.1. PHP_UML can generate XMI in both versions. Be warned, though, that some UML tools might not interpret accurately the data contained in your XMI file. For example, the link between a UML artifact (a source file) and the classes defined inside that artifact is only available from version 2 of UML. </para> </refsection> - <refsection><info><title>Example</title></info> - + + <refsection><info><title>Usage</title></info> + + <para>You can use PHP_UML either from <link linkend="package.php.php-uml.command-line">command line</link>, or by writing a piece of code that will exploit the API.</para> <example><info><title>Parsing a single file <filename>test.php</filename>, and generating its XMI file:</title></info> - <programlisting role="php"> <![CDATA[ <?php @@ -59,4 +75,25 @@ Note that, since UML is a strong object-oriented standard, <classname>PHP_UML</classname> ignores all "procedural" elements, like global functions, or global constants. </para> </refsection> + + <refsection><info><title>Compatibility of XMI</title></info> + <para>Your UML/XMI code might be interpreted differently by the modeling tool you are going to use along with PHP_UML. +This is particularly true for the version 2 of UML/XMI. +For instance, the Eclipse plug-ins (EMF, Papyrus) only accept a particular flavour of XMI, called "ecore", which is only partly compatible with the one you will get with <literal>PHP_UML</literal>. + </para> + </refsection> + + <refsection><info><title>Extension</title></info> + <para> + <classname>PHP_UML</classname> is designed with evolution in mind. By choosing <emphasis>XMI</emphasis> as the pivot format for representing object oriented program structures, PHP_UML can not only interface with many design tools. + It can also be transformed, through XSLT, into many other formats, like the HTML API documentation generator, included in <classname>PHP_UML</classname>. + </para> + <para> + To start your own transformation, create a folder under <filename>/Output</filename>, and create a <filename>main.xsl</filename> file inside (you can copy the one present in <filename>/Output/html</filename>). Run the method <literal>PHP_UML->export()</literal> and pass the name of your format as the first parameter. + </para> + <para>Instead of transforming XMI, another way to create new output formats is to create a PHP class that will directly exploite the metamodel that the parser has built, exactly like the package <literal>XMI</literal> does. + If you are interested by the PHP_UML project, and want to participate, do not hesitate to contact me. + </para> + </refsection> + </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-uml/api.xml?view=markup&rev=1.1 Index: peardoc/en/package/php/php-uml/api.xml +++ peardoc/en/package/php/php-uml/api.xml <?xml version="1.0" encoding="utf-8"?> <refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.php.php-uml.api"> <refnamediv> <refname>API</refname> <refpurpose>How to use PHP_UML from its API?</refpurpose> </refnamediv> <refsection><info><title>Principles</title></info> <para><literal>PHP_UML</literal> is structured in 5 packages:</para> <para> <itemizedlist> <listitem> <simpara> The main package, which contains the main class (<literal>PHP_UML</literal>) and some utility classes </simpara> <simpara> The <literal>PHP</literal> package, where the PHP parser resides </simpara> <simpara> The <literal>Metamodel</literal> package, which contains the data structures that <literal>PHP_UML</literal> is using to modelize the code parsed </simpara> <simpara> The <literal>XMI</literal> package, which contains classes that can serialize a metamodel into XMI code </simpara> <simpara> The <literal>Output</literal> package, which contains all the stuff to transform XMI into another format (like HTML) </simpara> </listitem> </itemizedlist> </para> <para> But the only class you need to know about is <literal>PHP_UML</literal>. Since the first release of the package, the API of that class has changed a little bit, and you will find several methods doing more or less the same job. </para> </refsection> <refsection><info><title>Examples</title></info> <example><info><title>Parsing of a single file <filename>test.php</filename>, and generation of its XMI file:</title></info> <programlisting role="php"> <![CDATA[ <?php require_once 'PHP/UML.php'; $uml = new PHP_UML(); $uml->setInput('test.php'); $uml->parse('foo'); // parses, and sets the name of the root package $uml->generateXMI(1); // generates XMI in version 1 $uml->saveXMI('test.xmi'); ?> ]]> </programlisting> </example> <para> Note that, since UML is a strong object-oriented standard, <classname>PHP_UML</classname> ignores all "procedural" elements, like global functions, or global constants. </para> <example><info><title>Parsing of two directories, ignoring the <filename>CSV</filename> folders, and generation of HTML documentation</title></info> <programlisting role="php"> <![CDATA[ <?php require_once 'PHP/UML.php'; $uml = new PHP_UML(); $uml->setInput(array('C:\Inetpub\foo', 'C:\Inetpub\libraries')); $uml->generateXMI(2); $uml->export('html', 'C:\Inetpub\api'); ?> ]]> </programlisting> </example> <example><info><title>Import of a XMI file, and generation of PHP code templates</title></info> <programlisting role="php"> <![CDATA[ <?php require_once 'PHP/UML.php'; $uml = new PHP_UML(); $uml->readXMIFile('foo.xmi'); $uml->export('php', 'C:\Inetpub\foo'); ?> ]]> </programlisting> </example> </refsection> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-uml/command-line.xml?view=markup&rev=1.1 Index: peardoc/en/package/php/php-uml/command-line.xml +++ peardoc/en/package/php/php-uml/command-line.xml <?xml version="1.0" encoding="utf-8"?> <refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.php.php-uml.command-line"> <refnamediv> <refname>Command line interface</refname> <refpurpose>How to run PHP_UML from the command line?</refpurpose> </refnamediv> <refsection><info><title>Install</title></info> <para> The executable <literal>phpuml</literal> relies on <link linkend="package.console.console-commandline">Console::CommandLine</link>. If you have followed the normal PEAR installation process to install <classname>PHP_UML</classname>, that dependency should have been resolved, and you should be able to run <literal>phpuml</literal> directly from the command line. </para> </refsection> <refsection><info><title>Arguments</title></info> <para>Pass the files and/or the directories to parse as arguments: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo ]]> </programlisting> </para> <para>Separate the different elements by a space: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/file1.php file2.php ]]> </programlisting> </para> <para>By default, <literal>phpuml</literal> will recursively parse the specified files/folders, and will echo the XMI code on the screen (UML/XMI version 2).</para> </refsection> <refsection><info><title>Options</title></info> <para>By default, the root package of a UML model is named "default". To rename it, use the option <literal>-n</literal>: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo -n MyProject ]]> </programlisting> </para> <para>To save the result in a particular place, instead of printing it on the screen, use <literal>-o</literal>: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo -n MyProject -o /var/tmp/ ]]> </programlisting> This will parse <filename>/var/www/foo</filename>, and save the XMI data to <filename>/var/tmp/MyProject.xmi</filename>. Use the dot to save to the current directory: <literal>-o .</literal> </para> <para>In addition to <emphasis>xmi</emphasis>, 2 output formats are also available: <emphasis>html</emphasis>, and <emphasis>php</emphasis>. They work by applying an XSL transformation to the XMI data (in UML version 2).</para> <para>Use the option <literal>-f</literal> to specify which format you want <literal>phpuml</literal> to generate. <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo -f html -o /var/tmp/ ]]> </programlisting> This will scan <filename>/var/www/foo</filename>, and create a full HTML documentation in <filename>/var/tmp/</filename>. </para> <para>To select which version of the UML/XMI standards you want your XMI to be written in, use the option <literal>-x</literal>: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo -x 1 -o /var/tmp/ ]]> </programlisting> Note that Argouml accepts only XMI only in version 1, while the Eclipse plugins (Ecore standard) only in version 2. </para> <para>By default, <literal>phpuml</literal> will parse only files with the extension <filename>.php</filename>. To modify this file pattern, use the <literal>- m</literal> selector: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo -m *.php *.txt ]]> </programlisting> This will parse all <filename>php</filename> <emphasis>and</emphasis> <filename>txt</filename> files. </para> <para>Other options are available. You will discover them by asking for help, like this: <programlisting role="text"> <![CDATA[ $ phpuml -h ]]> </programlisting> </para> </refsection> </refentry>
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-uml/conversion-rules.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/package/php/php-uml/conversion-rules.xml diff -u peardoc/en/package/php/php-uml/conversion-rules.xml:1.3 peardoc/en/package/php/php-uml/conversion-rules.xml:1.4 --- peardoc/en/package/php/php-uml/conversion-rules.xml:1.3 Thu Oct 9 15:16:48 2008 +++ peardoc/en/package/php/php-uml/conversion-rules.xml Sun Jan 4 21:55:56 2009 @@ -2,7 +2,7 @@ <refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.php.php-uml.conversion-rules"> <refnamediv> <refname>Conversion rules</refname> - <refpurpose>How do PHP elements map to UML?</refpurpose> + <refpurpose>How do PHP elements map to UML concepts?</refpurpose> </refnamediv> <refsection><info><title>Logical view</title></info> @@ -27,14 +27,14 @@ <itemizedlist> <listitem> <simpara> - by using the docblock <literal>@package</literal> in the comment of a class (or of a file) + by using the PHP <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.php.net/manual/en/language.namespaces.php">namespace</link> instruction </simpara> <simpara> - by interpreting the namespace of a class + by using the docblock <literal>@package</literal> in the comment of a class (or of a file) </simpara> </listitem> </itemizedlist> - In the latter case, <classname>PHP_UML</classname> understands the double-colon <literal>::</literal> as the package delimiter. This works in conjunction with the PHP namespacing instructions (<literal>namespace</literal> and <literal>use</literal>). + Note that the <literal>namespace</literal> and <literal>use</literal> instructions will be parsed only if you run PHP_UML with PHP from version 5.3. </para> </refsection> @@ -60,10 +60,10 @@ <itemizedlist> <listitem> <simpara> - A PHP file maps to an UML Component. + A class (or an interface) maps to an UML Component. </simpara> <simpara> - A physical folder maps to an UML Subpackage. + A logical package maps to an UML Subpackage. </simpara> </listitem> </itemizedlist> @@ -73,10 +73,10 @@ <itemizedlist> <listitem> <simpara> - A PHP file maps to an UML Component. + A class (or an interface) maps to an UML Component. </simpara> <simpara> - A physical folder maps to a nesting UML Component. + A logical package maps to a nesting UML Component. </simpara> </listitem> </itemizedlist> http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-uml/intro.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/package/php/php-uml/intro.xml diff -u peardoc/en/package/php/php-uml/intro.xml:1.3 peardoc/en/package/php/php-uml/intro.xml:1.4 --- peardoc/en/package/php/php-uml/intro.xml:1.3 Thu Oct 9 15:16:48 2008 +++ peardoc/en/package/php/php-uml/intro.xml Sun Jan 4 21:55:56 2009 @@ -4,44 +4,60 @@ <refname>Introduction</refname> <refpurpose>Purpose and simple usage example</refpurpose> </refnamediv> + <refsection><info><title>Description</title></info> - <para> <classname>PHP_UML</classname> is a reverse-engineering tool, and a documentation tool. </para> <para> - It parses PHP files and directories, and generates an XMI file corresponding to the parsed code. + It can parse PHP files and directories, and generate: + </para> + <para> + <itemizedlist> + <listitem> + <simpara> + A XMI file, reflecting the object structure of the code parsed + </simpara> + <simpara> + A full HTML API documentation, very similar to <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://java.sun.com/j2se/javadoc/reference/docs/">Javadoc</link> + </simpara> + <simpara> + PHP code skeletons (useful if you have an existing XMI file, and want to generate the files, folders and class declarations all at once) + </simpara> + </listitem> + </itemizedlist> </para> <para> - XMI is an <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.omg.org/">OMG</link> standard for exchanging metadata information via XML, and is commonly used as an interchange format for UML models. Many UML softwares support importing and exporting of XMI files. + <emphasis>XMI</emphasis> is an <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.omg.org/">OMG</link> standard for exchanging metadata information via XML, and is commonly used as an interchange format for UML models. Many UML softwares support importing and exporting of XMI files. </para> </refsection> + <refsection><info><title>Features</title></info> - <para> - Like <link linkend="package.php.phpdocumentor">PhpDocumentor</link>, <classname>PHP_UML</classname> can parse the following PHP elements: classes, interfaces, properties, and functions. It can also retrieve information from the inline comments, via the docblocks: <literal>@package</literal>, <literal>@var</literal>, <literal>@param</literal> + Like <link linkend="package.php.phpdocumentor">PhpDocumentor</link>, <classname>PHP_UML</classname> can parse the following PHP elements: namespaces, classes, interfaces, properties, and functions. It can also retrieve information from the inline comments, via the docblocks: <literal>@package</literal>, <literal>@var</literal>, <literal>@param</literal> <itemizedlist> <listitem> <simpara> <literal>@param</literal> and <literal>@var</literal> learn PHP_UML about the expected types of a parameter or a property. </simpara> <simpara> - <literal>@package</literal> learns PHP_UML about the nesting package of an element. + <literal>@package</literal> learns PHP_UML about the namespace of an element (even if, from PHP 5.3, it is recommended to use the PHP namespacing instructions instead) </simpara> </listitem> </itemizedlist> </para> <para> - So the more documented your PHP code is, the more precise your XMI file will be. + So the more documented your PHP code is, the more precise your XMI file, or your API documentation, will be. </para> <para> - At the current time, the UML/XMI standard exist in two different versions, 1.4 and 2.1. PHP_UML can generate XMI in both versions. Be warned, though, that some UML tools might not render well this or that aspect of your XMI file. For example, the link between an UML artifact (i.e. a source file) and the logical elements defined in the artifact is only available in version 2 of UML. + At the current time, the UML/XMI standards exist in two different versions, 1.4 and 2.1. PHP_UML can generate XMI in both versions. Be warned, though, that some UML tools might not interpret accurately the data contained in your XMI file. For example, the link between a UML artifact (a source file) and the classes defined inside that artifact is only available from version 2 of UML. </para> </refsection> - <refsection><info><title>Example</title></info> - + + <refsection><info><title>Usage</title></info> + + <para>You can use PHP_UML either from <link linkend="package.php.php-uml.command-line">command line</link>, or by writing a piece of code that will exploit the API.</para> <example><info><title>Parsing a single file <filename>test.php</filename>, and generating its XMI file:</title></info> - <programlisting role="php"> <![CDATA[ <?php @@ -59,4 +75,25 @@ Note that, since UML is a strong object-oriented standard, <classname>PHP_UML</classname> ignores all "procedural" elements, like global functions, or global constants. </para> </refsection> + + <refsection><info><title>Compatibility of XMI</title></info> + <para>Your UML/XMI code might be interpreted differently by the modeling tool you are going to use along with PHP_UML. +This is particularly true for the version 2 of UML/XMI. +For instance, the Eclipse plug-ins (EMF, Papyrus) only accept a particular flavour of XMI, called "ecore", which is only partly compatible with the one you will get with <literal>PHP_UML</literal>. + </para> + </refsection> + + <refsection><info><title>Extension</title></info> + <para> + <classname>PHP_UML</classname> is designed with evolution in mind. By choosing <emphasis>XMI</emphasis> as the pivot format for representing object oriented program structures, PHP_UML can not only interface with many design tools. + It can also be transformed, through XSLT, into many other formats, like the HTML API documentation generator, included in <classname>PHP_UML</classname>. + </para> + <para> + To start your own transformation, create a folder under <filename>/Output</filename>, and create a <filename>main.xsl</filename> file inside (you can copy the one present in <filename>/Output/html</filename>). Run the method <literal>PHP_UML->export()</literal> and pass the name of your format as the first parameter. + </para> + <para>Instead of transforming XMI, another way to create new output formats is to create a PHP class that will directly exploite the metamodel that the parser has built, exactly like the package <literal>XMI</literal> does. + If you are interested by the PHP_UML project, and want to participate, do not hesitate to contact me. + </para> + </refsection> + </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-uml/api.xml?view=markup&rev=1.1 Index: peardoc/en/package/php/php-uml/api.xml +++ peardoc/en/package/php/php-uml/api.xml <?xml version="1.0" encoding="utf-8"?> <refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.php.php-uml.api"> <refnamediv> <refname>API</refname> <refpurpose>How to use PHP_UML from its API?</refpurpose> </refnamediv> <refsection><info><title>Principles</title></info> <para><literal>PHP_UML</literal> is structured in 5 packages:</para> <para> <itemizedlist> <listitem> <simpara> The main package, which contains the main class (<literal>PHP_UML</literal>) and some utility classes </simpara> <simpara> The <literal>PHP</literal> package, where the PHP parser resides </simpara> <simpara> The <literal>Metamodel</literal> package, which contains the data structures that <literal>PHP_UML</literal> is using to modelize the code parsed </simpara> <simpara> The <literal>XMI</literal> package, which contains classes that can serialize a metamodel into XMI code </simpara> <simpara> The <literal>Output</literal> package, which contains all the stuff to transform XMI into another format (like HTML) </simpara> </listitem> </itemizedlist> </para> <para> But the only class you need to know about is <literal>PHP_UML</literal>. Since the first release of the package, the API of that class has changed a little bit, and you will find several methods doing more or less the same job. </para> </refsection> <refsection><info><title>Examples</title></info> <example><info><title>Parsing of a single file <filename>test.php</filename>, and generation of its XMI file:</title></info> <programlisting role="php"> <![CDATA[ <?php require_once 'PHP/UML.php'; $uml = new PHP_UML(); $uml->setInput('test.php'); $uml->parse('foo'); // parses, and sets the name of the root package $uml->generateXMI(1); // generates XMI in version 1 $uml->saveXMI('test.xmi'); ?> ]]> </programlisting> </example> <para> Note that, since UML is a strong object-oriented standard, <classname>PHP_UML</classname> ignores all "procedural" elements, like global functions, or global constants. </para> <example><info><title>Parsing of two directories, ignoring the <filename>CSV</filename> folders, and generation of HTML documentation</title></info> <programlisting role="php"> <![CDATA[ <?php require_once 'PHP/UML.php'; $uml = new PHP_UML(); $uml->setInput(array('C:\Inetpub\foo', 'C:\Inetpub\libraries')); $uml->generateXMI(2); $uml->export('html', 'C:\Inetpub\api'); ?> ]]> </programlisting> </example> <example><info><title>Import of a XMI file, and generation of PHP code templates</title></info> <programlisting role="php"> <![CDATA[ <?php require_once 'PHP/UML.php'; $uml = new PHP_UML(); $uml->readXMIFile('foo.xmi'); $uml->export('php', 'C:\Inetpub\foo'); ?> ]]> </programlisting> </example> </refsection> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-uml/command-line.xml?view=markup&rev=1.1 Index: peardoc/en/package/php/php-uml/command-line.xml +++ peardoc/en/package/php/php-uml/command-line.xml <?xml version="1.0" encoding="utf-8"?> <refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.php.php-uml.command-line"> <refnamediv> <refname>Command line interface</refname> <refpurpose>How to run PHP_UML from the command line?</refpurpose> </refnamediv> <refsection><info><title>Install</title></info> <para> The executable <literal>phpuml</literal> relies on <link linkend="package.console.console-commandline">Console::CommandLine</link>. If you have followed the normal PEAR installation process to install <classname>PHP_UML</classname>, that dependency should have been resolved, and you should be able to run <literal>phpuml</literal> directly from the command line. </para> </refsection> <refsection><info><title>Arguments</title></info> <para>Pass the files and/or the directories to parse as arguments: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo ]]> </programlisting> </para> <para>Separate the different elements by a space: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/file1.php file2.php ]]> </programlisting> </para> <para>By default, <literal>phpuml</literal> will recursively parse the specified files/folders, and will echo the XMI code on the screen (UML/XMI version 2).</para> </refsection> <refsection><info><title>Options</title></info> <para>By default, the root package of a UML model is named "default". To rename it, use the option <literal>-n</literal>: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo -n MyProject ]]> </programlisting> </para> <para>To save the result in a particular place, instead of printing it on the screen, use <literal>-o</literal>: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo -n MyProject -o /var/tmp/ ]]> </programlisting> This will parse <filename>/var/www/foo</filename>, and save the XMI data to <filename>/var/tmp/MyProject.xmi</filename>. Use the dot to save to the current directory: <literal>-o .</literal> </para> <para>In addition to <emphasis>xmi</emphasis>, 2 output formats are also available: <emphasis>html</emphasis>, and <emphasis>php</emphasis>. They work by applying an XSL transformation to the XMI data (in UML version 2).</para> <para>Use the option <literal>-f</literal> to specify which format you want <literal>phpuml</literal> to generate. <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo -f html -o /var/tmp/ ]]> </programlisting> This will scan <filename>/var/www/foo</filename>, and create a full HTML documentation in <filename>/var/tmp/</filename>. </para> <para>To select which version of the UML/XMI standards you want your XMI to be written in, use the option <literal>-x</literal>: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo -x 1 -o /var/tmp/ ]]> </programlisting> Note that Argouml accepts only XMI only in version 1, while the Eclipse plugins (Ecore standard) only in version 2. </para> <para>By default, <literal>phpuml</literal> will parse only files with the extension <filename>.php</filename>. To modify this file pattern, use the <literal>- m</literal> selector: <programlisting role="text"> <![CDATA[ $ phpuml /var/www/foo -m *.php *.txt ]]> </programlisting> This will parse all <filename>php</filename> <emphasis>and</emphasis> <filename>txt</filename> files. </para> <para>Other options are available. You will discover them by asking for help, like this: <programlisting role="text"> <![CDATA[ $ phpuml -h ]]> </programlisting> </para> </refsection> </refentry>