cypresslab/less-elephant
PHP wrapper around the Less (lessc) binary to manage and compile LESS projects. Uses Symfony Finder and Process, supports Composer/PEAR installation, includes PHPUnit tests, and follows Symfony2 coding standards. Requires PHP 5.3+ and a *nix system with lessc installed.
lessc binary, requiring a *nix environment. This limits its portability (Windows support is non-existent).LessElephantBundle), so manual setup is required.symfony/process:^6.0).lessc binary, risking silent failures in CI/CD.lessc is missing, the app crashes (no graceful fallback).lessc installation in all environments (*nix-only).isClean() returns false.lessc guaranteed to be available in all deployment environments (shared hosting, Docker, etc.)?less CLI via exec()) be more reliable?lessc is pre-installed).lessc support).lessc pre-installed.less).lessc, permission issues).| Component | Compatibility Risk | Mitigation |
|---|---|---|
| PHP Version | PHP 5.3–7.x (Laravel 5.x–8.x). Not compatible with Laravel 9+ (PHP 8.0+). | Use a PHP 7.4 Docker container or fork the package. |
| Symfony Dependencies | Uses Symfony Finder/Process v2.x (may conflict with Laravel’s v6.x+). | Isolate dependencies in a separate Composer package or vendor patch. |
| Operating System | Linux/macOS only (no Windows lessc support). |
Require Docker/VMs with lessc or switch to a cross-platform tool. |
| Laravel Ecosystem | No native Laravel integration (unlike Symfony bundles). | Wrap in a Service Provider or Facade for consistency. |
lessc in all environments:
# Ubuntu/Debian
sudo apt-get install less
# macOS (Homebrew)
brew install less
// app/Providers/LessElephantServiceProvider.php
public function register()
{
$this->app->singleton(LessProject::class, function () {
return new LessProject(
storage_path('app/less'),
'main.less',
public_path('css/main.css')
);
});
}
// app/Console/Commands/CompileLess.php
public function handle()
{
$project = new LessProject(storage_path('app/less'), 'main.less', public_path('css/main.css'));
if (!$project->isClean()) {
$project->compile();
}
}
php artisan less:compile.schedule->command('less:compile')->daily()).POST /admin/compile-less).lessc not found (environment misconfiguration).isClean() logic).lessc issues requires *nix expertise.lessc missing, permission errors).lessc makes switching tools difficult.isClean(): Inefficient for large LESS projects.lessc must be available everywhere.lessc must be bundled (increases image size).How can I help you explore Laravel packages today?