marcusschwarz/lesserphp
PHP port of LESS compiler for Laravel and other projects. Compile .less files to CSS in your build or runtime workflow with simple API integration. Useful for legacy apps needing LESS support without Node tooling.
sprintf type safety) or dependency vulnerabilities.@import, advanced mixins) may still exist.league/less-php)?php-less, league/less-php) with better PHP 8.x support?laravel-mix) for unsupported features?laravel-mix/postcss-less with this package only if PHP 8.x is mandatory. Use a custom Webpack loader or Artisan command to integrate:
// webpack.mix.js (if using Laravel Mix)
mix.less('resources/less/app.less', 'public/css', {
less: 'path/to/lesserphp/compiler.php' // Hypothetical integration
});
laravel-queue (now compatible with PHP 8.x).php vendor/bin/lesser compile input.less output.css) requires PHP 7.2+.laravel-mix with a custom PHP compiler (e.g., via mix.extend).@import, advanced functions).create_function).booted event or a custom Artisan command:
// app/Console/Commands/CompileLess.php
public function handle(): void {
$compiler = new \Lesser\Compiler();
$css = $compiler->compile(file_get_contents('resources/less/app.less'));
file_put_contents(public_path('css/app.css'), $css);
}
// app/Http/Middleware/CompileLess.php
public function handle($request, Closure $next) {
if (cache()->has('less_compiled_app')) {
return response(cache()->get('less_compiled_app'));
}
$css = $this->compileLess();
cache()->put('less_compiled_app', $css, now()->addHours(1));
return response($css);
}
sprintf changes).league/less-php) may be needed.README updates for PHP 8.x integrations.artisan in PHP 8.x due to JIT overhead.memory_get_usage()).How can I help you explore Laravel packages today?