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

cartalyst/phpsass is a pure-PHP implementation of the Sass stylesheet language, enabling PHP projects to compile .sass and .scss files to CSS without Ruby or external build tools. It is Composer-installable and suited for integrating Sass compilation into PHP applications, asset pipelines, and custom build workflows.

  • Compiles Sass and SCSS syntax to CSS
  • Supports variables, nesting, mixins, and imports
  • Runs entirely in PHP with no Ruby dependency
  • Easy Composer installation and autoloading
  • Useful for programmatic stylesheet builds in PHP apps
Frequently asked questions about Phpsass
How do I install cartalyst/phpsass with Composer?
Run composer require cartalyst/phpsass and let Composer autoload it. There is no documented setup page, so plan to read the vendor directory to discover the actual API surface. Note that the package lineage is a classmap/PSR-0 style library, so verify autoloading works with composer install --no-dev -o before deploying.
Does cartalyst/phpsass work with Laravel 10 and 11?
It is a standalone PHP library with no Laravel service provider, facade, or config file, so Laravel version support depends entirely on the PHP version it runs under. On Laravel 10 or 11 you are already on PHP 8.1+, and this code originates from the PHP 5.3 to 7.x era, so expect deprecation warnings and possible fatals. The composer.json php constraint may block installation outright on PHP 8.x, in which case you are forking and owning the code.
How do I compile an SCSS file to CSS in PHP using cartalyst/phpsass?
The typical entry point is SassParser::parse_file(), which takes a path plus an options array covering output style, load paths, and caching. You render the result to a string and write it to your public CSS directory. In Laravel this is usually wrapped in an Artisan command or a small service class and triggered as part of a build or deploy step.
What is the difference between cartalyst/phpsass and scssphp/scssphp?
Both are pure-PHP Sass compilers, but scssphp/scssphp is actively maintained, has better parity with modern Dart Sass semantics, and has a real release and security process. cartalyst/phpsass is a fork of the richthegeek/phpsass lineage, which is a port of early Ruby Sass, and it has zero stars, zero dependents, and no upstream to escalate to. For new work, scssphp is the default comparison point, and for most Laravel projects a Vite or Laravel Mix pipeline with Dart Sass is the better architectural answer.
Does cartalyst/phpsass support @use, @forward, and math.div?
No. The dialect is early Ruby Sass, not Dart Sass, so @use, @forward, and math.div are unsupported, and the slash operator still means division. Coverage of @each and @function is only partial as well. If your stylesheets use any of these features, grep for them first because a single search quantifies your migration cost.
Is cartalyst/phpsass still maintained and safe for production?
There is no active upstream maintenance, no CVE process, and no maintainer to escalate to, so adopting it means self-owning the code from day one. It is a keep-the-lights-on dependency, not something to put on a roadmap for greenfield work. Never feed it user-editable or request-time SCSS, since an unmaintained parser handling arbitrary input is both a denial-of-service and a correctness risk.
Why does my SCSS compile with cartalyst/phpsass but the CSS output differs from Dart Sass?
Silent CSS divergence is the dominant risk with this package. Because the parser implements early Ruby Sass semantics, modern-authored stylesheets can compile without errors yet emit subtly different CSS that passes all your existing tests. Run a parity spike that compiles your full production stylesheet set with both this package and Dart Sass and diff the output; treat that diff as the go/no-go gate before any integration work.
Does cartalyst/phpsass work on PHP 8?
Expect problems. The code dates from the PHP 5.3 to 7.x era, so you will likely hit each() deprecations, dynamic-property warnings, implicit-nullable-parameter warnings, and possibly fatals from functions removed in PHP 8. The composer.json php constraint may hard-block installation entirely. Also watch for a set_error_handler installed by the parser, which can collide with Laravel's own error handler when APP_DEBUG is true.
How do I configure load paths and caching in cartalyst/phpsass?
Load paths and cache settings are passed through the options array on the parser call, so there is no config file to edit. Be aware that include-path resolution is working-directory sensitive, meaning php artisan, a queue worker, and PHPUnit can resolve the same @import differently. Always pass absolute load paths rather than relying on the current working directory.
How does cartalyst/phpsass performance compare to Dart Sass or libsass?
It is CPU-bound pure PHP and materially slower than libsass or Dart Sass, so a build that takes 200ms with a native compiler can become 10 seconds or more here. Large ASTs also pressure memory_limit on big stylesheet sets. If you must use it, treat compilation as a build-time or cached step and never run it on a per-request path.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo