PHPackages                             wikimedia/less.php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wikimedia/less.php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wikimedia/less.php
==================

PHP port of the LESS processor

v5.5.1(3mo ago)12327.4M—9%200[10 issues](https://github.com/wikimedia/less.php/issues)20Apache-2.0PHPPHP &gt;=8.1CI failing

Since Apr 24Pushed 2w ago17 watchersCompare

[ Source](https://github.com/wikimedia/less.php)[ Packagist](https://packagist.org/packages/wikimedia/less.php)[ Docs](https://gerrit.wikimedia.org/g/mediawiki/libs/less.php)[ RSS](/packages/wikimedia-lessphp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (63)Used By (20)

[![Packagist](https://camo.githubusercontent.com/968d55a907ac30485f62516cf64a774ee1da52906622759a093899e0c7d91cdc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77696b696d656469612f6c6573732e7068702e7376673f7374796c653d666c6174)](https://packagist.org/packages/wikimedia/less.php)

Less.php
========

[](#lessphp)

This is a PHP port of the [official LESS processor](https://lesscss.org).

About
-----

[](#about)

The code structure of Less.php mirrors that of upstream Less.js to ensure compatibility and help reduce maintenance. The port aims to be compatible with Less.js 3.13.1. Please note that "inline JavaScript expressions" (via eval or backticks) are not supported.

- [API § Caching](./API.md#caching), Less.php includes a file-based cache.
- [API § Source maps](./API.md#source-maps), Less.php supports v3 sourcemaps.
- [API § Command line](./API.md#command-line), the `lessc` command includes a watch mode.

Installation
------------

[](#installation)

You can install the library with Composer or standalone.

If you have [Composer](https://getcomposer.org/download/) installed:

1. Run `composer require wikimedia/less.php`
2. Use `Less_Parser` in your code.

Or standalone:

1. [Download Less.php](https://gerrit.wikimedia.org/g/mediawiki/libs/less.php/+archive/HEAD.tar.gz) and upload the PHP files to your server.
2. Include the library: ```
    require_once '[path to]/less.php/lib/Less/Autoloader.php';
    Less_Autoloader::register();
    ```
3. Use `Less_Parser` in your code.

Security
--------

[](#security)

The LESS processor language is powerful and includes features that may read or embed arbitrary files that the web server has access to, and features that may be computationally exensive if misused.

In general you should treat LESS files as being in the same trust domain as other server-side executables, such as PHP code. In particular, it is not recommended to allow people that use your web service to provide arbitrary LESS code for server-side processing.

*See also [SECURITY](./SECURITY.md).*

Who uses Less.php?
------------------

[](#who-uses-lessphp)

- **[Wikipedia](https://en.wikipedia.org/wiki/MediaWiki)** and the MediaWiki platform ([docs](https://www.mediawiki.org/wiki/ResourceLoader/Architecture#Resource:_Styles)).
- **[Matomo](https://en.wikipedia.org/wiki/Matomo_(software))** ([docs](https://developer.matomo.org/guides/asset-pipeline#vanilla-javascript-css-and-less-files)).
- **[Magento](https://en.wikipedia.org/wiki/Magento)** as part of Adobe Commerce ([docs](https://developer.adobe.com/commerce/frontend-core/guide/css/preprocess/)).
- **[Icinga](https://en.wikipedia.org/wiki/Icinga)** in Icinga Web ([docs](https://github.com/Icinga/icingaweb2)).
- **[Shopware](https://de.wikipedia.org/wiki/Shopware)** ([docs](https://developers.shopware.com/designers-guide/less/)).
- **[Winter CMS](https://wintercms.com/)** ([docs](https://wintercms.com/docs/v1.2/docs/themes/development))
- **[Flarum](https://en.wikipedia.org/wiki/Flarum)** ([docs](https://docs.flarum.org/themes/))

Integrations
------------

[](#integrations)

Less.php has been integrated with various other projects.

#### Transitioning from Leafo/lessphp

[](#transitioning-from-leafolessphp)

If you're looking to transition from the [Leafo/lessphp](https://github.com/leafo/lessphp) library, use the `lessc.inc.php` adapter file that comes with Less.php.

This allows Less.php to be a drop-in replacement for Leafo/lessphp.

[Download Less.php](https://gerrit.wikimedia.org/g/mediawiki/libs/less.php/+archive/HEAD.tar.gz), unzip the files into your project, and include its `lessc.inc.php` instead.

Note: The `setPreserveComments` option is ignored. Less.php already preserves CSS block comments by default, and removes LESS inline comments.

#### Drupal

[](#drupal)

Less.php can be used with [Drupal's less module](https://drupal.org/project/less) via the `lessc.inc.php` adapter. [Download Less.php](https://gerrit.wikimedia.org/g/mediawiki/libs/less.php/+archive/HEAD.tar.gz) and unzip it so that `lessc.inc.php` is located at `sites/all/libraries/lessphp/lessc.inc.php`, then install the Drupal less module as usual.

#### WordPress

[](#wordpress)

- [wp\_enqueue\_less](https://github.com/Ed-ITSolutions/wp_enqueue_less) is a Composer package for use in WordPress themes and plugins. It provides a `wp_enqueue_less()` function to automatically manage caching and compilation on-demand, and loads the compressed CSS on the page.
- [JBST framework](https://github.com/bassjobsen/jamedo-bootstrap-start-theme) bundles a copy of Less.php.
- The [lessphp plugin](https://wordpress.org/plugins/lessphp/) bundles a copy of Less.php for use in other plugins or themes. This dependency can also be combined with the [TGM Library](http://tgmpluginactivation.com/).

Credits
-------

[](#credits)

Less.php was originally ported to PHP in 2011 by [Matt Agar](https://github.com/agar) and then updated by [Martin Jantošovič](https://github.com/Mordred) in 2012. From 2013 to 2017, [Josh Schmidt](https://github.com/oyejorge) lead development of the library. Since 2019, the library is maintained by Wikimedia Foundation.

Contribute
----------

[](#contribute)

- Issue tracker:
- Source code:  ([Get started with Gerrit](https://www.mediawiki.org/wiki/Gerrit/Tutorial/tl;dr))

###  Health Score

76

—

ExcellentBetter than 100% of packages

Maintenance89

Actively maintained with recent releases

Popularity68

Solid adoption and visibility

Community50

Growing community involvement

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 70.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~82 days

Total

62

Last Release

94d ago

Major Versions

1.8.2 → v2.0.02020-02-04

v2.0.0 → v3.0.02020-03-11

v3.2.1 → v4.0.02023-03-11

v4.4.1 → v5.0.02024-06-27

PHP version history (7 changes)v1.3.0PHP &gt;=5.3.5

v1.4.2b3PHP &gt;=5.2

v1.7.0.5PHP &gt;=5.3

1.8.2PHP &gt;=7.2.9

v2.0.0PHP &gt;=7.1

v4.0.0PHP &gt;=7.4.3

v5.4.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/b94d9718c06ec7c3fd7a104bc44966fb7464b9ec7411582343ea35a7a6a85f08?d=identicon)[mediawiki](/maintainers/mediawiki)

![](https://www.gravatar.com/avatar/716c86d71cbf921e7912a505f89d799de398fc0a3af0bd4c8862834b2d642bd7?d=identicon)[wikimedia](/maintainers/wikimedia)

![](https://www.gravatar.com/avatar/a91173408bf645b6ff78a309a9e55bde405d29c72e2b1ae8ec9f9df1225f76c3?d=identicon)[Krinkle](/maintainers/Krinkle)

---

Top Contributors

[![oyejorge](https://avatars.githubusercontent.com/u/1043524?v=4)](https://github.com/oyejorge "oyejorge (1169 commits)")[![Krinkle](https://avatars.githubusercontent.com/u/156867?v=4)](https://github.com/Krinkle "Krinkle (138 commits)")[![anny21](https://avatars.githubusercontent.com/u/34449508?v=4)](https://github.com/anny21 "anny21 (54 commits)")[![paladox](https://avatars.githubusercontent.com/u/5727000?v=4)](https://github.com/paladox "paladox (36 commits)")[![jdforrester](https://avatars.githubusercontent.com/u/881572?v=4)](https://github.com/jdforrester "jdforrester (36 commits)")[![umherirrender](https://avatars.githubusercontent.com/u/1174884?v=4)](https://github.com/umherirrender "umherirrender (30 commits)")[![agar](https://avatars.githubusercontent.com/u/245425?v=4)](https://github.com/agar "agar (28 commits)")[![polishdeveloper](https://avatars.githubusercontent.com/u/3909689?v=4)](https://github.com/polishdeveloper "polishdeveloper (24 commits)")[![MaxSem](https://avatars.githubusercontent.com/u/1260606?v=4)](https://github.com/MaxSem "MaxSem (19 commits)")[![Asenar](https://avatars.githubusercontent.com/u/1180301?v=4)](https://github.com/Asenar "Asenar (17 commits)")[![Mordred](https://avatars.githubusercontent.com/u/29232?v=4)](https://github.com/Mordred "Mordred (14 commits)")[![thiemowmde](https://avatars.githubusercontent.com/u/6576639?v=4)](https://github.com/thiemowmde "thiemowmde (12 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (10 commits)")[![Nodge](https://avatars.githubusercontent.com/u/1094801?v=4)](https://github.com/Nodge "Nodge (8 commits)")[![dkrnl](https://avatars.githubusercontent.com/u/734622?v=4)](https://github.com/dkrnl "dkrnl (6 commits)")[![mlocati](https://avatars.githubusercontent.com/u/928116?v=4)](https://github.com/mlocati "mlocati (5 commits)")[![zghosts](https://avatars.githubusercontent.com/u/4441963?v=4)](https://github.com/zghosts "zghosts (4 commits)")[![DannyS712](https://avatars.githubusercontent.com/u/46829944?v=4)](https://github.com/DannyS712 "DannyS712 (4 commits)")[![pafnuty](https://avatars.githubusercontent.com/u/1635679?v=4)](https://github.com/pafnuty "pafnuty (4 commits)")[![PhrozenByte](https://avatars.githubusercontent.com/u/920356?v=4)](https://github.com/PhrozenByte "PhrozenByte (4 commits)")

---

Tags

phpcsslessstylesheetless.jslesscss

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wikimedia-lessphp/health.svg)

```
[![Health](https://phpackages.com/badges/wikimedia-lessphp/health.svg)](https://phpackages.com/packages/wikimedia-lessphp)
```

###  Alternatives

[scssphp/scssphp

scssphp is a compiler for SCSS written in PHP.

62827.7M220](/packages/scssphp-scssphp)[mishal/iless

Less.js port to PHP

4737.0k3](/packages/mishal-iless)[dkcwd/dkcwd-zf2-munee

Zend Framework 2 module leveraging 'munee' an asset optimisation library developed by Cody Lundquist. You can find munee at http://github.com/meenie/munee

102.1k](/packages/dkcwd-dkcwd-zf2-munee)[tailwindphp/tailwindphp

A full port of TailwindCSS 4.x to PHP

171.7k1](/packages/tailwindphp-tailwindphp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
