Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 9, 2024 via composer

sabberworm/php-css-parser 8.0.0

Parser for CSS Files written in PHP
Package summary
Share
2
issues
2
high severity
vulnerability
2
1
license
1
MIT
Package created
2 Aug 2012
Version published
30 Jun 2016
Maintainers
3
Total deps
1
Direct deps
0
License
MIT

Issues

2

2 high severity issues

high
via: sabberworm/php-css-parser@8.0.0
via: sabberworm/php-css-parser@8.0.0
Collapse
Expand

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
sabberworm/php-css-parser@8.0.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of sabberworm/php-css-parser 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does sabberworm/php-css-parser do?

The sabberworm/php-css-parser is a PHP library that provides a comprehensive parsing solution for CSS files. It allows developers to read CSS files into a data structure that can be manipulated and output as optimized CSS. This makes it possible to work with CSS files programmatically, offering a high degree of control and flexibility.

How do you use sabberworm/php-css-parser?

To make use of the sabberworm/php-css-parser, you need to first install it via Composer using the command composer require sabberworm/php-css-parser. Once installed, you can create a new instance of the Parser and read a file using example code like the one below:

$parser = new \Sabberworm\CSS\Parser(file_get_contents('somefile.css'));
$cssDocument = $parser->parse();

The resulting CSS document structure can then be manipulated prior to being output. There are settings to control character sets, enable strict parsing, and disable multibyte functions. Here's a code snippet showing how to manipulate the CSS.

$myId = "#my_id";
$parser = new \Sabberworm\CSS\Parser($css);
$cssDocument = $parser->parse();
foreach ($cssDocument->getAllDeclarationBlocks() as $block) {
    foreach ($block->getSelectors() as $selector) {
        $selector->setSelector($myId.' '.$selector->getSelector());
    }
}

Finally, you can output the CSS by using the render() method:

print $cssDocument->render();

This can be formatted using an instance of type \Sabberworm\CSS\OutputFormat.

Where are the sabberworm/php-css-parser docs?

The sabberworm/php-css-parser docs are contained within its README file on the project's GitHub page. The README includes a detailed explanation of how to use the library, code usage examples, and an overview of its structure and features. Developers looking to integrate this library into their projects will find the README a comprehensive resource for understanding how to effectively leverage the power of sabberworm/php-css-parser.