Accès direct au contenu Accès direct à la navigation

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 :

  1. ~$ 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 the __DIR__.'/../tmp/' directory outside of the GIT clone :

  1.     'build_dir' => __DIR__.'/phpdoc'
  2.     'cache_dir' => __DIR__.'/../tmp/cache/NAMEOFPACKAGE'

The latest version of the master branch’s documentation is available online for all of our packages at

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 :

  1. ~$ path/to/phpunit

Use option -h for the help ; many configuration settings can be defined as command line options.

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 :

  1. ~$ php vendor/phpmd/phpmd/src/bin/phpmd src text codesize

Or, if you installed it globally in your system :

  1. ~$ phpmd src text codesize

The result is a full list of methods out of the limits, with concerned file and line.