PSR0

Tip of the day: Phing, Composer and namespaced Task classes

Submitted by Frederic Marand on

Among the interesting features of Phing is its extensibility, and of the hallmarks of that exensibility is the ability to define new Task types as PHP classes, which are by default located in the default namespace only. Can we do better ?

Step 0: "Ad-hoc" (inline) tasks

At the simplest, Task classes are created by embedding ad-hoc tasks like:

OSInet library converted to PSR0 / PSR1

Submitted by Frederic Marand on

Over the last few days, I finally decided to revisit the old OSInet PHP library, to dust it off somehow, and convert the class-based parts to PSR0 and the whole to what seems to be liable to become PSR1 at some point.

This library contains a zoo of function helping with PHP-GTK development, and three packages with their demo application:

Class Grapher
Build a graph of inheritance and interface implementations on a directory (and subdirectories) of PHP code
This package uses the Drupal Grammar Paser to parse code, and includes a Drush 5 plugin for easy use within a Drupal site, but can also be used to parse non-Drupal code, as long as the Grammar Parser - which does not depend on Drupal either - is installed in the include path.
It is a more complete version of the Drupal-only Class Grapher sandbox on drupal.org.
In the current version, graphs are generated using GraphViz. An extension to a client-side visualization tool like the Infovis toolkit should come someday. Suggestions for other client-side libraries welcome (please comment!).
Open Document Calc reader
This package provides a few classes and methods to extract the content of OpenDocument (LibreOffice, OpenOffice.org, ...) spreadsheets.
Finite State Machine
This package is used to build applications designed around a finite state machine, and is mostly intended for use in PHP-GTK applications, to provide asynchronous processing.
The demo application uses the PHP FTP extension to expose its asynchronous notifications in a PHP-GTK UI