{"id":15041712,"url":"https://github.com/absalomedia/sassphp","last_synced_at":"2025-10-07T21:31:04.298Z","repository":{"id":23443088,"uuid":"26806559","full_name":"absalomedia/sassphp","owner":"absalomedia","description":"PHP bindings to libsass - fast, native Sass parsing in PHP!","archived":false,"fork":true,"pushed_at":"2023-05-21T12:29:38.000Z","size":313,"stargazers_count":57,"open_issues_count":2,"forks_count":14,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-01-03T10:45:11.753Z","etag":null,"topics":["apache","php","sass","zend"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"sensational/sassphp","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/absalomedia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-18T11:38:54.000Z","updated_at":"2024-10-23T22:25:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/absalomedia/sassphp","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/absalomedia%2Fsassphp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/absalomedia%2Fsassphp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/absalomedia%2Fsassphp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/absalomedia%2Fsassphp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/absalomedia","download_url":"https://codeload.github.com/absalomedia/sassphp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235656464,"owners_count":19024770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache","php","sass","zend"],"created_at":"2024-09-24T20:46:24.048Z","updated_at":"2025-10-07T21:30:58.995Z","avatar_url":"https://github.com/absalomedia.png","language":"C","funding_links":["https://www.patreon.com/bePatron?u=14641360"],"categories":[],"sub_categories":[],"readme":"# sassphp\n\nThe `sass` extension for PHP gives you an object-oriented system of parsing [Sass](http://sass-lang.com/) from within your PHP applications. Under the hood it uses [libsass](https://github.com/hcatlin/libsass) to provide super speedy and compatible Sass parsing.\n\n![Libsass 3.6.3](https://img.shields.io/badge/libsass-3.6.3-yellow.svg) [![Build Status](https://travis-ci.org/absalomedia/sassphp.svg)](https://travis-ci.org/absalomedia/sassphp) [![codecov](https://codecov.io/gh/absalomedia/sassphp/branch/master/graph/badge.svg)](https://codecov.io/gh/absalomedia/sassphp) [![Patreon](https://img.shields.io/badge/patreon-donate-green.svg)](https://www.patreon.com/bePatron?u=14641360)\n\n## What's Sass?\n\nSass is a CSS pre-processor language to add on exciting, new, awesome features to CSS. Sass was the first language of its kind and by far the most mature and up to date codebase.\n\nSass was originally created by Hampton Catlin ([@hcatlin](http://twitter.com/hcatlin)). The extension and continuing evolution of the language has all been the result of years of work by Natalie Weizenbaum ([@nex3](http://twitter.com/nex3)) and Chris Eppstein ([@chriseppstein](http://twitter.com/chriseppstein)).\n\nFor more information about Sass itself, please visit [http://sass-lang.com](http://sass-lang.com)\n\n## Installation\n\nCurrently, the only way to install the extension is manually:\n\n    $ git clone git://github.com/absalomedia/sassphp\n\nRemember to grab your submodules:\n\n    $ git submodule init\n    $ git submodule update\n\nAlso remember that libsass now uses submodules on its own, so update those too.\n\n...and compile it! I've written a little PHP script to do all the stuff you need to do:\n\n    $ php install.php\n\nRun the tests:\n\n    $ make test\n\nFinally, you can install with `make`:\n\n    $ make install\n\nAnd then add it to your _php.ini_:\n\n    extension=sass.so\n\nAlways remember to enable it within PHP as well\n\n    phpenmod sass\n\n## Binary installation / deployment\n\nAs long as you have the final 'sass.so' extension file, you can deploy SASS PHP across any server. There's a few caveats, of course. The development \u0026 production servers have to run the same version of PHP. You then copy the installed 'sass.so' from the /usr/lib/php/\u003cphp version\u003e directory shown during 'make install' on your development environment to the same directory on your production boxes.\n\nAs usual, make sure you add the extension to your _php.ini_ on your production environments:\n\n    extension=sass.so\n\nAlways remember to enable it within PHP as well\n\n    phpenmod sass\n\n## Usage\n\nThis extension has a very simple API:\n\n    $sass = new Sass();\n    $css = $sass-\u003ecompile($source);\n\nYou can compile a file with `compileFile()`:\n\n    $sass = new Sass();\n    $css = $sass-\u003ecompileFile($source);\n\nYou can set the include path for the library to use:\n\n    $sass = new Sass();\n    $sass-\u003esetIncludePath('/tmp');\n    $css = $sass-\u003ecompile($source);\n\nYou can set the style of your SASS file to suit your needs:\n\n    $sass = new Sass();\n    $sass-\u003esetStyle(Sass::STYLE_NESTED);\n\n    $sass = new Sass();\n    $sass-\u003esetStyle(Sass::STYLE_EXPANDED);\n\n    $sass = new Sass();\n    $sass-\u003esetStyle(Sass::STYLE_COMPACT);\n\n    $sass = new Sass();\n    $sass-\u003esetStyle(Sass::STYLE_COMPRESSED);\n\nAs the [Libsass](https://github.com/hcatlin/libsass) library has matured to get closer to 100% SASS coverage, so this extension has also matured:\n\n- SASS file compilation is an array when a source map file is specified.\n- The ability to define source comments\n- The ability to embed the source map into the CSS output\n- The ability to specify .SASS file input instead of .SCSS\n- The ability to set a source map path, required when generating a dedicated .map file\n- The ability to define a root directory for the source map itself\n- SASS importer \u0026 functions capabilities\n- PHP 7.0 to PHP 7.4 support, with tests for PHP 8\n\nThe output of `compileFile()` is an array when creating source map files, allowing both compiled SASS file and .map file to be generated in the same function call.\n\nAs there are multiple ways of generating source comments, there are now PHP level settings to control that output.\n\nTo generate source comments for a file inline:\n\n    $sass = new Sass();\n    $sass-\u003esetComments(true);\n    $css = $sass-\u003ecompileFile($source);\n\nAliases also exist so you can also use:\n\n    $css = $sass-\u003ecompile_file($source);\n\nYou can tell the compiler to use indented syntax (SASS syntax). By default it expects SCSS syntax:\n\n    $sass = new Sass();\n    $sass-\u003esetIndent(true); //TRUE -\u003e SASS, FALSE -\u003e SCSS\n    $css = $sass-\u003ecompile($source);\n\nYou can tell the compiler to embed the source map into the actual CSS file as well:\n\n    $sass = new Sass();\n    $sass-\u003esetEmbed(true);\n    $css = $sass-\u003ecompile($source);\n\nYou can set the source map file for the library to use:\n\n    $sass = new Sass();\n    $sass-\u003esetMapPath('/random.output.css.map');\n    $css = $sass-\u003ecompileFile($source);\n\nThis needs to be done prior to getting the output of the map file. As it stands, both the output of the SASS file compile \u0026 the SASS source map file generation sequence are both strings.\n\nThe first array item will always be the compiled SASS file:\n\\$css[0]\n\nThe second array item will always be the source map output:\n\\$css[1]\n\nYou can set the root of the generated source map file like so:\n\n    $sass = new Sass();\n    $sass-\u003esetMapRoot('/some/dir');\n    $sass-\u003esetMapPath('/random.output.css.map');\n    $css = $sass-\u003ecompileFile($source);\n\nIf there's a problem, the extension will throw a `SassException`:\n\n    $sass = new Sass();\n\n    try\n    {\n        $css = $sass-\u003ecompile('dayrui3dui36di37');\n    }\n    catch (SassException $e)\n    {\n        // $e-\u003egetMessage() - ERROR -- , line 1: invalid top-level expression\n\n        $css = FALSE;\n    }\n\n## Variant builds\n\nThese extensions also utilise the [Libsass](https://github.com/hcatlin/libsass) library \u0026 remain in varying states of completion:\n\n- Facebook [HHVM](https://github.com/absalomedia/sasshhvm) native (non Zend) extension - with Libsass 3.5.5 - tested up to HHVM 3.11.x\n- [Nginx](https://github.com/absalomedia/sass-nginx-module) module - with Libsass 3.5.5\n\n## Changelog\n\n| Release | Description                                                                               |\n| ------- | ----------------------------------------------------------------------------------------- |\n| 0.7.0   | Librarian - Functions \u0026 importers                                                         |\n| 0.6.2   | Solskjær - Manchester (Libsass 3.6.3)                                                     |\n| 0.6.1   | Bond - Monaco (Libsass 3.6.1)                                                             |\n| 0.6.0   | Symfony - Composer integration                                                            |\n| 0.5.17  | Engine - Vroom vroom (Libsass 3.5.5)                                                      |\n| 0.5.16  | Humpback - Maloo (Libsass 3.5.4)                                                          |\n| 0.5.15  | Fallout - Atom (Libsass 3.5.2)                                                            |\n| 0.5.14  | Karol - Caroline (Libsass 3.4.8)                                                          |\n| 0.5.13  | Ray - Manta (Libsass 3.4.5) \u0026 PHP stub file                                               |\n| 0.5.12  | Cartography - MapRoot functions                                                           |\n| 0.5.11  | Zoomer (Libsass 3.4.4) stable                                                             |\n| 0.5.10  | Elwood (Libsass 3.4.3) stable \u0026 Travis fix                                                |\n| 0.5.9   | Rickshaw (Libsass 3.4.2) stable                                                           |\n| 0.5.8   | AI - KITT (Libsass 3.4.0) stable                                                          |\n| 0.5.7   | Hancock - Optimise loops \u0026 Travis. Simplify changelog documentation                       |\n| 0.5.6   | Green Giant - PHP5 \u0026 PHP7 stable build - All Travis builds passing                        |\n| 0.5.5   | Herbie (Libsass 3.3.6) stable                                                             |\n| 0.5.2   | Delorean (Libsass 3.3.3) stable \u0026 continuing PHP7 rewrite                                 |\n| 0.5.1   | Eleanor (Libsass 3.3.2) stable                                                            |\n| 0.5.0   | Start of PHP 7 compatibility                                                              |\n| 0.4.9   | Too Fast To Furious (Libsass 3.3.1) stable                                                |\n| 0.4.8   | Greased Lightning (Libsass 3.3.0) stable                                                  |\n| 0.4.7   | SCSS vs SASS detection - indents                                                          |\n| 0.4.6   | Travis experimental (unreleased)                                                          |\n| 0.4.5   | Holiday Patch (Libsass 3.2.5) stable                                                      |\n| 0.4.4   | Refactor correctly for LibSass 3.2.4                                                      |\n| 0.4.2   | CamelCase compile sequence                                                                |\n| 0.4.1   | Addition of SOURCE_DEFAULT test \u0026 structure. Revise other tests                           |\n| 0.4.0   | Refactor file compliation. Basic tests for source comments. Expand documentation          |\n| 0.3.9   | Addition of source map url paths to SASS file compilation                                 |\n| 0.3.5   | Restructure of compile sequence (file only at this time) to account for source map output |\n| 0.3.0   | Addition of source comments - none, inline, file. Set default to none.                    |\n| 0.2.0   | Changed methods to be non-static. Allow setting include-path and image-path               |\n| 0.1.0   | Initial release                                                                           |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabsalomedia%2Fsassphp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabsalomedia%2Fsassphp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabsalomedia%2Fsassphp/lists"}