PHPackages                             websemantics/lcss2php - 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. websemantics/lcss2php

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

websemantics/lcss2php
=====================

Conveniently extracts variable declarations from multiple Less / Scss sources and returns a PHP associative array.

1.0.4(8y ago)359.6k↑300%MITPHPPHP &gt;=5.3.0

Since Nov 23Pushed 8y ago2 watchersCompare

[ Source](https://github.com/websemantics/lcss2php)[ Packagist](https://packagist.org/packages/websemantics/lcss2php)[ Docs](https://github.com/websemantics/lcss2php)[ RSS](/packages/websemantics-lcss2php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

```
                                       ╭────────▞────────╮
                                       │                 │
                                       │   ╭─────────╮   │
                                       │   │         │   │
        ┬  ╭─╮╭─╮╭─╮    ╭─╮╭─╮╭─╮╭─╮   ┃   │   ░ ░░░ │   ┃ ┬╭─╮    ╭─╮┬ ┬╭─╮    ╭─╮┬ ┬╭─╮
        │  ├┤ ╰─╮╰─╮    ╰─╮│  ╰─╮╰─╮   ┃   │   ░░░░░ │   ┃─┤├─╯    ├─╯├─┤├─╯    ├─╯├─┤├─╯
        ┴─╯╰─╯╰─╯╰─╯    ╰─╯╰─╯╰─╯╰─╯   ┃   ╰─────────╯   ┃ ┴┴      ┴  ┴ ┴┴      ┴  ┴ ┴┴
    ╭──────────────────────────────────┤                 ├──────────────────────────────────╮
    │  ◯   ◯   ◯   ◯   ◯   ◯   ◯   ◯   │   ▯ ▯ ▯ ▯ ▯ ▯   │  ◯   ◯   ◯   ◯   ◯   ◯   ◯   ◯   │
    ╰──┬┬─────┬┬─────┬┬─────┬┬─────┬┬──┤                 ├───┬┬─────┬┬─────┬┬─────┬┬─────┬┬─╯
       ││     ││     ││     ││     ││  │      ╭───╮      │   ││     ││     ││     ││     ││
    ───┤├─────┤├─────┤├─────┤├─────┤├──┤      │───│      ├───┤├─────┤├─────┤├─────┤├─────┤├────
      ─┴┴ ─   ┴┴    ─┴┴   ─ ┴┴─   ─┴┴  │      │   │      │   ┴┴ ─  ─┴┴─    ┴┴─   ─┴┴   ─ ┴┴─
                                       ╰──────╯   ╰──────╯

```

> A straightforward library that extracts variable declarations from multiple `Less` / `Scss` sources and returns a `PHP` associative array.

Install
-------

[](#install)

1- Use `Composer` to install as follows,

```
composer require websemantics/lcss2php
```

Getting Started
---------------

[](#getting-started)

Pass a list of files (`Less`, `Scss` or a mix ) to a newly created instance of `Lcss2php` class. Get a list of all the variables using the `all` method.

```
$files = ['/usr/etc/variables.less', '/usr/etc/_variables.scss'];

$lcss2php = new Lcss2php($files);

$variables = $lcss2php->all();
```

By default all variable types are returned, for example, `Color`, `Dimension`, etc. You can use the `ignore` function to filter some types from the final variables list,

```
$variables = (new Lcss2php($files))->ignore(['Color', 'Dimension'])->all();
```

Notice that, there are two different variable types for each lanaguage (`Less`, `Scss`). For a list of all the types, check class `Type` at `lcss2php/src/Node/Type.php`.

Example
-------

[](#example)

Quick run of what to expect; take this `Scss` example code,

```
$green: #24ce7b !default;
$blue: #38b5e6 !default;
$orange: #f48714 !default;
$red: #f6303e !default;

$brand-success: $green;
$brand-info: $blue;
$brand-warning: $orange;
$brand-danger: $red;

$spacer: 1rem !default;
$spacer-x: $spacer !default;
$spacer-y: $spacer !default;
```

Will be converted to,

```
[
  "green" => "#24ce7b"
  "blue" => "#38b5e6"
  "orange" => "#f48714"
  "red" => "#f6303e"
  "brand-success" => "#24ce7b"
  "brand-info" => "#38b5e6"
  "brand-warning" => "#f48714"
  "brand-danger" => "#f6303e"
  "spacer" => "1rem"
  "spacer-x" => "1rem"
  "spacer-y" => "1rem"
]
```

Support
-------

[](#support)

Star ⭐ this repository if you find this project useful, to show support or simply, for being awesome :)

Need help or have a question? post at \[StackOverflow\]( websemantics).

*Please don't use the issue trackers for support/questions.*

Contribution
------------

[](#contribution)

Contributions to this project are accepted in the form of feedback, bugs reports and even better - pull requests.

Open Source
-----------

[](#open-source)

These project have been used in the making of this project, thanks you!

- [SCSS Compiler](https://github.com/oyejorge/less.php), SCSS compiler written in PHP.
- [LESS Compiler](https://github.com/leafo/scssphp), Less.js ported to PHP.

License
-------

[](#license)

[MIT license](http://opensource.org/licenses/mit-license.php)Copyright (c) Web Semantics, Inc.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 94.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 ~101 days

Total

5

Last Release

3057d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0cfed068d359c1d9532498c807304a191d59e0aca0e735ccb0c3b7ae99992ed0?d=identicon)[websemantics](/maintainers/websemantics)

---

Top Contributors

[![websemantics](https://avatars.githubusercontent.com/u/2190455?v=4)](https://github.com/websemantics "websemantics (36 commits)")[![schmidex](https://avatars.githubusercontent.com/u/2202857?v=4)](https://github.com/schmidex "schmidex (1 commits)")[![stijntilleman](https://avatars.githubusercontent.com/u/1871004?v=4)](https://github.com/stijntilleman "stijntilleman (1 commits)")

---

Tags

lessphpscssphplaravelsassscsslesspyrocms

### Embed Badge

![Health badge](/badges/websemantics-lcss2php/health.svg)

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

###  Alternatives

[scssphp/scssphp

scssphp is a compiler for SCSS written in PHP.

62827.7M220](/packages/scssphp-scssphp)[efficiently/larasset

Larasset is a library for Laravel 5 which manage assets in an easy way.

684.8k](/packages/efficiently-larasset)[nizsheanez/yii2-asset-converter

Less, Sass, Scss and Phamlp converter for Yii2. No system requires. yii2-composer support, Less autoupdate, customizing of output directory

64167.5k6](/packages/nizsheanez-yii2-asset-converter)[trentrichardson/cakephp-shrink

Compiles, combines, and minifies javascript, coffee, less, scss, and css

1619.3k](/packages/trentrichardson-cakephp-shrink)[zizaco/lessy

Lessy is a simple and lean LESS compiler for Laravel

2116.7k](/packages/zizaco-lessy)

PHPackages © 2026

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