PHPackages                             scssphp/server - 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. scssphp/server

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

scssphp/server
==============

Server for on-the-fly .scss compilation

1.10.1(3y ago)7141.4k—2.5%7[2 issues](https://github.com/scssphp/server/issues)[1 PRs](https://github.com/scssphp/server/pulls)MITPHPCI failing

Since Jan 22Pushed 3y ago2 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (7)Used By (0)

Server Example
--------------

[](#server-example)

If you just want to start serving compiled `scss` files as quick as possible then start here. The **scssphp/server** project provides an easy-to-use example that demonstrates how to automatically compile `scss` files and serve them from a directory that you specify.

Create a file, like `style.php`:

```
use ScssPhp\Server\Server;

$directory = "stylesheets";

$server = new Server($directory);
$server->serve();

```

Create the directory set in the script alongside the script, then add your `scss` files to it.

By default, **scssphp** expects a `scss_cache` directory to exist inside the stylesheets directory where it will cache the compiled output. This way it can quickly serve the files if no modifications have been made. Your PHP script must have permission to write in `scss_cache`.

Going to the URL `example.com/style.php/style.scss` will attempt to compile `style.scss` from the `stylesheets` directory, and serve it as CSS.

If it can not find the file it will return an HTTP 404 page:

```
/* INPUT NOT FOUND scss v0.0.1 */

```

If the file can't be compiled due to an error, then an HTTP 500 page is returned. Similar to the following:

```
Parse error: failed at 'height: ;' stylesheets/test.scss on line 8

```

Also, because SCSS server writes headers, make sure no output is written before it runs.

### Constructor

[](#constructor)

Use the `Server` constructor to specify the cache directory and even the instance of the `Compiler` that is used to compile SCSS.

- `new Server($sourceDir, $cacheDir, $scss)` creates a new server that serves files from `$sourceDir`. The cache dir is where the cached compiled files are placed. When `null`, `$sourceDir . '/scss_cache'` is used. `$scss`is the instance of `scss` that is used to compile.

Just call the `serve` method to let it render its output.

Here's an example of creating a SCSS server that outputs compressed CSS:

```
use ScssPhp\ScssPhp\Compiler;
use ScssPhp\Server\Server;

$scss = new Compiler();
$scss->setOutputStyle(\ScssPhp\ScssPhp\OutputStyle::COMPRESSED);

$server = new Server('stylesheets', null, $scss);

$server->serve();

```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 61.5% 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 ~213 days

Recently: every ~248 days

Total

6

Last Release

1242d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/75c5d927b0434111db9720dd78af8c83385cf28bb9aeafd031ba8cb0c4ffc558?d=identicon)[Stof](/maintainers/Stof)

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

---

Top Contributors

[![robocoder](https://avatars.githubusercontent.com/u/922051?v=4)](https://github.com/robocoder "robocoder (8 commits)")[![dleffler](https://avatars.githubusercontent.com/u/83437?v=4)](https://github.com/dleffler "dleffler (1 commits)")[![greew](https://avatars.githubusercontent.com/u/189321?v=4)](https://github.com/greew "greew (1 commits)")[![GromNaN](https://avatars.githubusercontent.com/u/400034?v=4)](https://github.com/GromNaN "GromNaN (1 commits)")[![kristaps777](https://avatars.githubusercontent.com/u/51639263?v=4)](https://github.com/kristaps777 "kristaps777 (1 commits)")[![timmit-nl](https://avatars.githubusercontent.com/u/7703799?v=4)](https://github.com/timmit-nl "timmit-nl (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/scssphp-server/health.svg)

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

###  Alternatives

[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)[winter/storm

Winter CMS Storm Library

46239.3k6](/packages/winter-storm)[mapbender/mapbender

Mapbender library

10117.4k5](/packages/mapbender-mapbender)[chasegiunta/scss

Compiler for SCSS

148.6k1](/packages/chasegiunta-scss)[arnolem/tailwindphp

TailwindPHP - use Tailwind CSS in your PHP projects (without npm)

131.1k](/packages/arnolem-tailwindphp)

PHPackages © 2026

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