PHP code example of ikimea / lessphp

1. Go to this page and download the library: Download ikimea/lessphp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ikimea / lessphp example snippets




use Lessphp\Lessc;

$less = new Lessc;
echo $less->compile(".block { padding: 3 + 4px }");


echo $less->compileFile("input.less");


$less->checkedCompile("input.less", "output.css");


try {
  $less->compile("invalid LESS } {");
} catch (exception $e) {
  echo "fatal error: " . $e->getMessage();
}