PHP code example of zxqfox / css-selector-parser
1. Go to this page and download the library: Download zxqfox/css-selector-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zxqfox / css-selector-parser example snippets
use CSSSelectorParser\Parser;
$parser = new Parser();
$parser->registerSelectorPseudos('has');
$parser->registerNestingOperators('>', '+', '~');
$parser->registerAttrEqualityMods('^', '$', '*', '~');
$parser->enableSubstitutes();
$css = 'a[href^=/], .container:has(nav) > a[href]:lt($var)';
echo json_encode($parser->parse($css), JSON_PRETTY_PRINT);