A library to manage a less project with PHP

Installs: 4 188

Dependents: 3

Stars: 3

Watchers: 1

Forks: 2

Language: PHP

0.2.5 2013-06-05 21:25 UTC


A wrapper for the less binary written in PHP


  • php >= 5.3
  • *nix system with less (lessc binary) installed


for tests



To install LessElephant with composer you simply need to create a composer.json in your project root and add:

    "require": {
        "cypresslab/less-elephant": "<=1.0.0"

Then run

$ wget -nc
$ php composer.phar install

You have now LessElephant installed in vendor/cypresslab/lesselephant

And an handy autoload file to include in you project in vendor/.composer/autoload.php


Add the Cypresslab channel

$ pear channel-discover

And install the package. By now LessElephant is in alpha state. So remember the -alpha in the library name

$ pear install cypresslab/LessElephant-alpha

On Cypresslab pear channel homepage you can find other useful information


The library is tested with PHPUnit.

Go to the base library folder and run the test suites

$ phpunit

Code style

How to use

Remember to give the user the right permissions to access the filesystem. If you are using a web server give permissions to both your user and the web server user.



$project = new LessProject("/path/to/less/folder", "screen.less", "/path/to/css/screen.css"); // create the base class

// optionally you can pass a project name and a custom LessBinary class
$project = new LessProject(
    new LessBinary("/path/to/lessc")

manage a less project

// return false if the project needs to be recompiled. In other words if you changed something in any of your less files after the last sylesheets generation
if (!$project->isClean()) {
    $project->compile(); // compile the project
echo $project->isClean(); // returns true

Staleness Checker

LessElephant checks if the project need to be compiled with the awesome Symfony Finder component, by scanning your source less folder


LessElephantBundle let symfony do the work for you