shyim/sasso-ffi
PHP FFI bindings for libsass that let you compile SCSS/Sass stylesheets directly from PHP without a native extension, offering a lightweight, fast option for asset pipelines and build tooling.
Architecture fit — shyim/php-sasso-ffi is a thin PHP FFI binding over libsass, giving PHP an in-process SCSS → CSS compiler with no ext-*, no Node/Dart toolchain, and no subprocess. For a Laravel app already running PHP-only containers, it removes an entire runtime dependency from the asset pipeline. Fit is strongest where SCSS is compiled at build/deploy time and the output is cacheable; it is a poor fit where the codebase depends on the modern Sass module system, since libsass is end-of-life upstream and frozen at the pre-@use language level.
Integration feasibility — Simple as a library: composer require shyim/php-sasso-ffi. It ships no Laravel service provider, facade, config file, or Blade directive, so first integration means writing our own singleton binding, cache layer, and error mapping. The 0.1.1 change lowers the floor meaningfully: adopting shyim/composer-binary-downloader fetches a prebuilt libsass shared object instead of requiring headers and a C++ toolchain on every host. That converts a "compile it yourself" onboarding problem into a "trust a Composer plugin" problem — a trade worth making, but a different review, not a smaller one.
Technical risk
@use/@forward, modern color functions, or newer CSS syntax will not compile. This is the dominant long-term risk and the reason to treat the package as a bridge, not a foundation.ext-ffi; the hardened ffi.enable=preload mode conflicts with lazily loading the library at runtime, so we choose between loosening FFI hardening and preloading at opcache boot. That's a security review item.composer install. This needs an explicit allow-plugins entry, network egress in CI/build, and a documented answer on checksum verification and mirroring before it clears a supply-chain gate.Key questions
Stack fit — Works for any Laravel 10/11/12 app on PHP 8.1+ with ext-ffi available. First-class fit for teams that want zero non-PHP build tooling and are compiling a legacy SCSS corpus (Bootstrap-era, @import-style partials). Poor fit for design systems already on the Sass module system, or for projects needing PostCSS/Tailwind-style plugin chains — this package compiles Sass and nothing else.
Migration path
allow-plugins entry, and cache the Composer layer so builds don't re-download each run.Compatibility — Pin exactly (0.1.1, not ^0.1) until 1.0. Confirm PHP and Laravel version bounds, ext-ffi presence in every image (queue worker and scheduler too, not just web), and glibc/musl parity between laptops and production base images. Lock the Composer plugin version as well — it is now part of the build graph.
Sequencing
SassCompiler contract with a cache keyed on source hash plus import graph, bound as a singleton; expose via a Blade helper only after the wrapper is stable.Maintenance — Small code surface (a wrapper plus a cache) but a non-trivial dependency tail: PHP minor upgrades can break FFI struct bindings, libsass is frozen upstream, and the package is pre-1.0 with one maintainer. Budget a standing "re-verify on PHP upgrade" line item rather than assuming it is inert. Realistically this is a two-to-three-year bridge with a known exit.
Support — No vendor. Support is GitHub issues plus reading libsass C API docs when something breaks. Internal runbooks must own: how to pin and upgrade, how to mirror binaries, how to diagnose FFI load failures, and how to fall back to the previous pipeline. Name a single owner; this should not orphan in a platform team's backlog.
Scaling — Compilation is CPU-bound inside the PHP process. For build-time compilation this is irrelevant. For runtime compilation it competes with request workers: cap it, cache aggressively (source hash + all partials), and never compile in a hot request path — compile on deploy or in a queue. Under Octane, verify the libsass handle's lifecycle across worker restarts; a leaked FFI handle per worker is a slow memory climb that is very hard to attribute later. Preloading the library can cut per-process init cost if we accept ffi.enable=preload.
Failure modes to plan for
composer install fails outright. Mitigation: mirrored artifact, cached layer, documented source-build fallback.@use) → compile exception at build. Mitigation: lint the stylesheet corpus against libsass in CI.composer update → Mitigation: exact pins plus mandatory lockfile review.Ramp-up — A Laravel developer can integrate this in under a day; it is a library call behind a wrapper. The real learning cost sits elsewhere: FFI enablement and its security trade-offs, the new Composer plugin/binary-download build step, and libsass's language limitations versus modern Sass. Estimate ~1 day engineering and ~2–3 days for output-parity validation plus security/CI review — that review, not the code, is the critical path. Front-load it before committing the team to removing the existing asset pipeline.
How can I help you explore Laravel packages today?