Download the PHP package shyim/sasso without Composer
On this page you can find all versions of the php package shyim/sasso. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sasso
php-sasso
A PHP extension that compiles SCSS / Sass → CSS natively, in-process, with
no Node, no Dart VM, and no subprocess. It is a thin ext-php-rs binding around
sasso — a pure-Rust, zero-dependency dart-sass alternative that matches
current dart-sass byte-for-byte on the subset it implements.
The loaded extension is named sasso (extension=sasso, php -m shows
sasso, extension_loaded('sasso')); php-sasso is just the repository name.
Requirements
- PHP 8.2+ (developed against 8.5)
- A Rust toolchain (
cargo) libclangfor bindgen (macOS:brew install llvm)
Install with PIE
The package is PIE-compatible. With a Rust toolchain available, PIE builds the
extension from source (via phpize/configure/make, which shell out to cargo)
and installs it:
Then enable it in your php.ini:
Build & install manually
This builds --release and copies the module into $(php-config --extension-dir)
as sasso.so. Then enable it in your php.ini with extension=sasso.so.
Equivalently, the PIE/pecl build flow works directly:
To try it without installing:
Usage
The API is object-oriented: a single fluent Sasso\Compiler class.
Fluent compiler
Custom importer
@import / @use / @forward can be resolved from anywhere — a database, an
archive, a virtual filesystem — by implementing the Sasso\Importer interface
and passing an instance to setImporter():
The importer is consulted first; any addImportPath() load paths act as a
fallback when resolve() returns null. If resolve() returns null and
nothing else resolves the URL, the import fails with a CompileException.
If resolve() throws, that exception propagates out of compile()
unchanged — same class, code and message — so you can surface a real error
(a missing DB row, an I/O failure) instead of a generic "stylesheet not found":
Indented .sass syntax
API
Sasso\Compiler
| Method | Description |
|---|---|
__construct() |
Defaults: expanded, SCSS, Unicode diagnostics. |
setStyle(int $style): static |
STYLE_EXPANDED or STYLE_COMPRESSED. |
setSyntax(int $syntax): static |
SYNTAX_SCSS, SYNTAX_SASS or SYNTAX_CSS. |
setUnicode(bool $on): static |
Unicode vs ASCII diagnostic glyphs. |
setUrl(?string $url): static |
Display path for diagnostics (enables snippets). |
addImportPath(string $path): static |
Append an @import/@use load path. |
setImportPaths(array $paths): static |
Replace all load paths. |
setImporter(?Sasso\Importer $importer): static |
Userland resolver (load paths are the fallback); null clears. |
compile(string $source): string |
Compile; throws Sasso\CompileException. |
Sasso\Importer (interface)
| Method | Description |
|---|---|
resolve(string $url): ?string |
Return the partial's SCSS/Sass source for $url, or null if not found. |
All setters return $this for chaining. Invalid STYLE_* / SYNTAX_* values are
reported (as a thrown exception) at compile() time.
Constants (on Sasso\Compiler)
STYLE_EXPANDED = 0, STYLE_COMPRESSED = 1,
SYNTAX_SCSS = 0, SYNTAX_SASS = 1, SYNTAX_CSS = 2.
License
MIT OR Apache-2.0, matching sasso.