This document explains the different tools we usually use to install/update dependencies in our packages.
Composer: PHP dependencies manager
We use Composer to automatically install/update the required external PHP packages our own packages are based on.
Some of our packages are registered in the Packagist.
Sami: the new documentation generator
In the past we often used PHP Documentor to generate a documentation of our scripts.
But we now use Sami as it is really easy-to-use and is naturally managed by Composer.
As long as the package contains a
sami.config.php file (often at its root directory),
a documentation can be generated running:
~$ php path/to/vendor/sami/sami/sami.php render sami.config.php
The HTML documentation is generated in a
phpdoc/ directory that is NOT under version-control.
Sami requires temporary directories for this generation that are set, by default, to
__DIR__.'/../tmp/' directory outside of the GIT clone:
'build_dir' => __DIR__.'/phpdoc' 'cache_dir' => __DIR__.'/../tmp/cache/NAMEOFPACKAGE'
The latest version of the
master branch's documentation is available online for all of
our packages at http://docs.ateliers-pierrot.fr.
PHPUnit: the unit testing suite
We try to prepare a set of unit-tests to validate each evolution of work on a package by
using PHPUnit. Our tests will often be
found in a
tests/ directory and the PHPUnit configuration resides in the file :
phpunit.xml.dist. If you find this file in a package, you can run:
-h for the help ; many configuration settings can be defined as command
Most of our packages that uses some unit-tests are integrated in the Travis CI automatic website, that validate the package after each commit.
PHP Mess Detector: see how the code is poorly written
To follow the common "best practices" and keep our code maintainable and understandable, we try to keep it under the accepted limits of programmation language and organization. To check the code complexity, we use PHP Mess Detector which shows all part of the code out of these limits. "PHPMD" is mostly included in the Composer "dev" dependencies of our packages, so it is installed locally for any "dev" installation.
Once installed, just run:
~$ php vendor/phpmd/phpmd/src/bin/phpmd src text codesize
Or, if you installed it globally in your system:
~$ phpmd src text codesize
The result is a full list of methods out of the limits, with concerned file and line.
Copyleft (c) 2008-2014 Les Ateliers Pierrot - Paris, France - Some rights reserved.
Scripts are licensed under the GNU General Public License version 3.
Contents are licensed under the Creative Commons - Attribution - Share Alike - Unported - version 3.0 license.