Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpsass Laravel Package

cartalyst/phpsass

Cartalyst PHPSass is a PHP implementation of the Sass CSS preprocessor, letting you compile SCSS and Sass stylesheets directly in PHP without Ruby. It supports variables, nesting, mixins, and inheritance for building maintainable stylesheets.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. cartalyst/phpsass occupies a narrow architectural niche: server-side SCSS compilation inside a PHP process, with no Node, Ruby, or Dart Sass in the deploy path. For a Laravel application already running the Cartalyst stack (Theme / Platform / Sentinel) whose theme layer assumes an in-PHP compiler, that is a coherent fit — the compiler sits alongside the code that consumes its output, and the deploy artifact is CSS. For everything else, it is the weaker answer to a question that should be framed as pipeline architecture, not package selection: the real choice is "does stylesheet compilation live inside the PHP application, or in a Vite / Laravel Mix / Dart Sass asset pipeline?" A maintained pure-PHP alternative (scssphp/scssphp) exists and should be the default comparison point. This package should never appear in an RFP or roadmap for greenfield work; it is a keep-the-lights-on input.

Integration feasibility. Technically straightforward, organizationally not. Composer installation works, the API is small (SassParser::parse_file() with an options array for style, load_paths, cache), and it can be driven from an Artisan command or a service provider within an hour. Two caveats dominate. First, the documentation and the code lineage disagree: the marketing copy describes a libsass wrapper (SassCompiler::compile()), while the richthegeek/phpsass lineage is a pure-PHP port of early Ruby Sass with a different API surface and a materially different performance and language-coverage profile. That contradiction is both a scoping risk and a documentation-integrity signal. Second, there is no published docs page and no package-discovery guarantee — the vendor directory is the documentation, and the first hour of work is reading it.

Technical risk. Ranked by severity:

  1. Silent CSS divergence. The dominant risk. The dialect is early Ruby Sass, not Dart Sass: no @use, no @forward, no math.div, / still means division, and @each/@function coverage is partial. Modern-built stylesheets can compile cleanly with different semantics and emit subtly wrong CSS that passes every existing test.
  2. PHP 8.x incompatibility. The lineage originates in the PHP 5.3–7.x era. Expect each() deprecations, dynamic-property warnings, implicit-nullable-parameter warnings, and possible fatals from removed functions. The composer.json php constraint may hard-block installation on 8.x — in which case you are already forking and owning the code.
  3. Abandonment. Zero stars, zero dependents, no CVE process, no upstream to escalate to. Adopting this is self-owned code from day one.
  4. Autoload and CI drift. Classmap/PSR-0 packages behave differently under composer install --no-dev -o than in dev; the failure mode is a class-not-found at deploy time that never reproduces locally.
  5. Runtime side effects. Pure-PHP Sass parsers commonly install a set_error_handler to convert warnings into exceptions, which can collide with Laravel's handler under APP_DEBUG=true. Include-path resolution is also working-directory sensitive — php artisan, a queue worker, and PHPUnit resolve @import differently.
  6. Performance and memory. CPU-bound and materially slower than libsass or Dart Sass; a 200ms build can become 10+ seconds, with large ASTs pressuring memory_limit.
  7. Untrusted input. Never feed it user-editable or request-time SCSS. An unmaintained parser with no security process handling arbitrary input is both a DoS and a correctness risk.

Key questions.

  • Is this adoption forced by a Cartalyst-stack constraint, or are we choosing it over scssphp/scssphp or a Node pipeline? If the latter, the decision needs justification.
  • Does the existing stylesheet set use @use, @forward, @function, @each, or math.div? A single grep quantifies the migration cost.
  • Does the parity spike — full production stylesheet set compiled by this package vs. Dart Sass, diffed — produce cosmetic or structural differences? This is the go/no-go gate and it must happen before any integration work.
  • What is the package's actual php constraint, and does it install on every version in our CI matrix?
  • Who owns this dependency by name, and what is the dated exit criterion?

Integration Approach

Stack fit. Adopt only behind a contract the application owns. This is the cheapest risk control available and it is non-negotiable for an unmaintained parser: it converts an irreversible vendor choice into a one-line container binding.

interface StylesheetCompiler { public function compile(string $source, array $options = []): string; }

A PhpSassCompiler implementation wraps SassParser; AppServiceProvider::register() binds the interface as a singleton. No Blade template, controller, or model calls the parser directly. When the swap to scssphp/scssphp happens, only that one class changes — commands, tests, and helpers stay put.

Migration path. Start with a parity spike, not an integration. Compile the full production stylesheet set with this package and with Dart Sass, then diff:

npx sass resources/scss/app.scss /tmp/dart.css --style=compressed
php spike.php > /tmp/phpsass.css
diff -u /tmp/dart.css /tmp/phpsass.css | head -100

Cosmetic, explainable diffs → a contained legacy dependency. Structural diffs — missing rules, wrong values, dropped media queries — → stop and go straight to scssphp/scssphp. Everything downstream depends on this one result.

Compatibility. Pin an exact version (composer require cartalyst/phpsass:1.0.4), never a floating constraint on an unmaintained package. Put include paths, output style, and entrypoint lists in config/styles.php and resolve them absolute via resource_path() / base_path() — relative paths fail differently across artisan, queue workers, and tests. Disable the parser's internal disk cache ('cache' => false) and do hash-based caching yourself, keyed explicitly on source content; the parser's own mtime cache writes to temp directories that misbehave on read-only or containerized filesystems. Verify composer install --no-dev -o in a clean container before relying on autoload behavior.

Sequencing.

  1. Read the vendor directory. Confirm the php constraint, autoload strategy, whether a Laravel provider block exists, and the actual entry class and methods. Correct the "libsass wrapper" claim in any internal deck before it reaches an estimate.
  2. Parity spike against Dart Sass. Day one. Gate the rest on the diff.
  3. Define the StylesheetCompiler contract and the wrapper implementation. No application code touches the parser.
  4. Artisan command, not request-time compilation. php artisan styles:compile with a --force flag, md5-based staleness check, and per-entrypoint output. Call it from the deploy hook after composer install, before route:cache.
  5. Golden-file snapshot tests per entrypoint, with a deliberate --update-snapshots path so a compiler swap or PHP upgrade produces a loud, reviewable diff instead of a silent one. Add a test that compiles from a different working directory.
  6. Ship the runbook and the replacement note. How to recompile, where fixtures live, how to regenerate them; and the swap target (scssphp/scssphp, similar shape), the interface, and the validation steps (parity diff plus golden-file suite).
  7. Log it on the tech-debt register with a named owner, pinned version, and dated exit criterion.

Dynamic theming. Do not compile at request time. Compile design tokens to CSS custom properties at build time and emit per-tenant values from the database:

<style>:root { --brand-primary: {{ $tenant->brand_primary }}; }</style>

Same white-label capability, faster, safer, and it removes the compiler from the request cycle entirely — which is the stronger product decision regardless of which compiler is underneath.

Operational Impact

Maintenance. Self-owned from the moment it is installed. Zero stars, zero dependents, no upstream maintainer, no security process. Budget ongoing effort for: patching PHP 8.x deprecations and fatals, keeping the pinned version consistent across environments, regenerating golden fixtures on intentional stylesheet changes, and periodically re-running the parity diff. The realistic ceiling is a small, static, legacy stylesheet set — not a growing design system.

Support. There is no external support channel. Documentation is the vendor directory. Institutional knowledge must be written down in the same week as adoption: the runbook, the replacement note, and the named owner. The person who can swap this out in an afternoon is the person who wrote that note; if that person leaves without it, the cost of replacement rises sharply.

Scaling. Poorly. Compilation is CPU-bound and single-threaded per entrypoint; pure-PHP parsing of large stylesheet sets is orders of magnitude slower than libsass or Dart Sass and can push a 200ms build past 10 seconds. Mitigations: keep compilation strictly in the build/deploy path, parallelize per entrypoint when there are many, watch memory_limit (large ASTs), and cache aggressively on source hash. Under no circumstances should it run in the request cycle — that path does not scale at all and turns a build-time cost into user-facing latency.

Failure modes. The dangerous ones are quiet:

  • Silent CSS divergence — compiles cleanly, passes all tests, ships wrong CSS. Caught only by golden-file tests and the parity diff.
  • PHP 8 fatals or deprecations — caught by a CI matrix covering both ends of the supported PHP range.
  • Class-not-found at deploy — classmap/PSR-0 autoloading under --no-dev -o. Caught only by a clean-container composer install verification.
  • Include-path resolution failures — working-directory sensitivity across Artisan, queue workers, and PHPUnit. Caught by an explicit cross-CWD test.
  • Error-handler collisions — the parser's set_error_handler interfering with Laravel's exception pipeline under APP_DEBUG=true. Bounded by running compilation in a separate process (Artisan command or CI step), which is the right architecture anyway.
  • Disk-cache failures — silent or thrown on read-only/containerized filesystems. Eliminated by 'cache' => false.
  • Resource exhaustion from untrusted input — eliminated by policy: trusted, version-controlled SCSS only.

Ramp-up. Low technical ramp-up, moderate organizational ramp-up. A competent Laravel developer can wrap SassParser and wire an Artisan command in under a day; the API is small and the concept familiar. The real ramp-up cost is elsewhere: reading the vendor directory to establish what was actually installed (the libsass-versus-pure-PHP contradiction must be resolved from source, not from the description), building the parity-spike habit, and internalizing that the Sass dialect is early Ruby Sass — that / is division, that @use and @forward do not exist, and that a "clean compile" is not evidence of correctness. Budget the first hour for reading the vendor tree, the first day for the parity spike, and one engineer-week for the wrapper, command, config, golden-file suite, and the two runbook artifacts — and treat that estimate as contingent on the parity spike passing.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core