sabberworm/php-css-parser
Parse and manipulate CSS in PHP with a fast, flexible parser. Convert CSS into an object model, inspect and edit rules, selectors, and declarations, then render back to CSS. Useful for minifying, rewriting assets, or building CSS tooling.
[@layer](https://github.com/layer), [@scope](https://github.com/scope), and [@starting-style](https://github.com/starting-style) (#1549)Full Changelog: https://github.com/MyIntervals/PHP-CSS-Parser/compare/v9.2.0...v9.3.0
OutputFormat::setSpaceAroundSelectorCombinator() (#1504)RuleSet\RuleContainer is renamed to RuleSet\DeclarationList (#1530, #1539)setRule() in RuleSet and DeclarationBlock have been renamed
to setDeclaration(), etc. (#1521)Rule\Rule class is renamed to Property\Declaration
(#1508, #1512, #1513, #1522)Rule::setRule() and getRule() are replaced with setPropertyName() and
getPropertyName() (#1506)Selector is now represented as a sequence of Selector\Component objects
which can be accessed via getComponents(), manipulated individually, or set
via setComponents() (#1478, #1486, #1487, #1488, #1494, #1496, #1536, #1537)Selector::setSelector() and Selector constructor will now throw exception
upon provision of an invalid selectior (#1498, #1502)DeclarationBlock::setSelectors() are no longer
preserved (#1407)RuleSet\RuleContainer is deprecated; use RuleSet\DeclarationList instead
(#1530)setRule() in RuleSet and DeclarationBlock are deprecated;
there are direct replacements such as setDeclaration() (#1521)Rule\Rule class is deprecated; Property\Declaration is a direct
replacement (#1508)Rule::setRule() and getRule() are deprecated and replaced with
setPropertyName() and getPropertyName() (#1506, #1519)} is encountered (#1425, #1426)DeclarationBlock::setSelectors() (#1419)removeDeclarationBlockBySelector() to be order-insensitve (#1406)calc expressions when a newline immediately precedes or
follows a + or - operator (#1399)Full Changelog: https://github.com/MyIntervals/PHP-CSS-Parser/compare/v9.1.0...v9.2.0
RuleContainer for RuleSet Rule manipulation methods (#1256)rgb and rgba, and hsl and hsla are now aliases (#797)none as color function component value (#859)DeclarationBlock no longer extends RuleSet and instead has a RuleSet as
a property; use getRuleSet() to access it directly (#1194)null (not zero) (#1288)setPosition() (in Rule and other classes) now has fluent interface,
returning itself (#1259)RuleSet::removeRule() now only allows Rule as the parameter
(implementing classes are AtRuleSet and DeclarationBlock);
use removeMatchingRules() or removeAllRules() for other functions (#1255)RuleSet::getRules() and getRulesAssoc() now only allow string or null
as the parameter (implementing classes are AtRuleSet and DeclarationBlock)
(#1253)KeyFrame properties to sensible defaults (#1146)OutputFormat final (#1128)Selector a Renderable (#1017)string for some OutputFormat properties (#885)getLineNo() from these classes (use getLineNumber() instead):
Comment, CSSList, SourceException, Charset, CSSNamespace, Import,
Rule, DeclarationBlock, RuleSet, CSSFunction, Value (#1258)Rule::getColNo() (use getColumnNumber() instead) (#1287)getAllValues() is no longer
supported and will not work;
the search pattern should now be passed as the second argument (#1243)getAllValues() is no longer
supported and will not work; the flag for searching in function arguments
should now be passed as the third argument (#1243)__toString() (#1046)OutputFormat (#898)atRuleArgs() from the AtRule interface (#1141)OutputFormat::get() and ::set() (#1108, #1110)Rule (#995)getLineNo() from the Renderable interface (#1038)OutputFormat::level() (#874)Parser::setCharset/getCharset (#808)Rule::getValues() (#582)Rule::setValues() (#562)Document::getAllSelectors() (#561)DeclarationBlock::getSelector() (#559)DeclarationBlock::setSelector() (#560)OutputFormat (#1345):not) with comma-separated arguments (#1292):not(html, body)) (#1293)Rule before sibling even with different property name
(in RuleSet::addRule()) (#1270)RuleSet::addRule() sets non-negative column number when sibling
provided (#1268)rgb colors with percentage values using hex notation (#803)@ziegenberg is a new contributor to this release and did a lot of the heavy lifting. Thanks! :heart:
RuleSet::removeMatchingRules() method
(for the implementing classes AtRuleSet and DeclarationBlock) (#1249)RuleSet::removeAllRules() method
(for the implementing classes AtRuleSet and DeclarationBlock) (#1249)CSSElement (#1231)getLineNumber and getColumnNumber which return a nullable int
for the following classes:
Comment, CSSList, SourceException, Charset, CSSNamespace, Import,
Rule, DeclarationBlock, RuleSet, CSSFunction, Value (#1225, #1263)Positionable interface for CSS items that may have a position
(line and perhaps column number) in the parsed CSS (#1221)getAllValues() are deconflated, so it now takes three (all
optional), allowing $element and $ruleSearchPattern to be specified
separately (#1241)Positionable in the following CSS item classes:
Comment, CSSList, SourceException, Charset, CSSNamespace, Import,
Rule, DeclarationBlock, RuleSet, CSSFunction, Value (#1225)string or null to RuleSet::removeRule() is deprecated
(implementing classes are AtRuleSet and DeclarationBlock);
use removeMatchingRules() or removeAllRules() instead (#1249)Rule to RuleSet::getRules() or getRulesAssoc() is deprecated,
affecting the implementing classes AtRuleSet and DeclarationBlock
(call e.g. getRules($rule->getRule()) instead) (#1248)getAllValues() is deprecated;
the search pattern should now be passed as the second argument (#1241)getAllValues() is deprecated;
the flag for searching in function arguments should now be passed as the third
argument (#1241)getLineNo() is deprecated in these classes (use getLineNumber() instead):
Comment, CSSList, SourceException, Charset, CSSNamespace, Import,
Rule, DeclarationBlock, RuleSet, CSSFunction, Value (#1225, #1233)Rule::getColNo() is deprecated (use getColumnNumber() instead)
(#1225, #1233)Rule::setPosition() is
deprecated (pass null instead if there is no line number) (#1225, #1233)RuleSet::addRule() called with only column number set
(#1265)RuleSet::addRule() has valid position (#1262)OutputFormat properties for space around specific list separators (#880)OutputFormat constructor as [@internal](https://github.com/internal) (#1131)OutputFormatter as [@internal](https://github.com/internal) (#896)Selector::isValid() as [@internal](https://github.com/internal) (#1037)[@internal](https://github.com/internal) (#908)OutputFormat::nextLevel() as [@internal](https://github.com/internal) (#901)[@internal](https://github.com/internal) (#886)OutputFormat (#1131)OutputFormat::get() and ::set() (#1107)-webkit-calc and -moz-calc (#1086)OutputFormat to OutputFormatter
(#894)__toString() (#1006)Rule (#993, #1003)OutputFormat properties for space around list separators as an array (#880)OutputFormat::level() (#870)Size with correct types in expandBackgroundShorthand (#814)[@font-face](https://github.com/font-face) src property as comma-delimited list (#794)[@internal](https://github.com/internal) (#711)Parser::setCharset() and Parser::getCharset() (#703)dvh, lvh and svh length units (#415)[@internal](https://github.com/internal) (#500)CalcFunction::parse() (#593)turns unit with turn (#350)ParserState::strsplit() (#344)calc()vminCSSList#replace%[@import](https://github.com/import)eval for the comparison in getSelectorsBySpecificity, in case it gets passed untrusted input (CVE-2020-13756). Also fixed in 8.3.1, 8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, 1.0.1.vmcalc expessions when the first operand is a negative number, thanks to @raxbg.\0 and \9 can now be parsed (and rendered) in lenient mode. Thanks (again) to @FMCorz.Sabberworm\CSS\Parsing\SourceException instead of \Exception.E_NOTICESabberworm\CSS\Value\String class has been renamed to Sabberworm\CSS\Value\CSSString.$oBlock->removeSelector($mSelector){…} into the CSS document./** Perfectly valid **/How can I help you explore Laravel packages today?