Require? Include?
neotropic2023 opened this issue · comments
neotropic2023 commented
To read a file, for example, you’d do the following:
REQUIRE('......................................'); <-- And what file do we call?
$oCssParser = new Sabberworm\CSS\Parser(file_get_contents('somefile.css'));
$oCssDocument = $oCssParser->parse();
Raphael Schweikert commented
If you installed with composer, you’ll want to require 'vendor/autoload.php';
(see the docs).
mikeytown2 commented
You can also use this as a simple psr-0 class loader
<?php
set_include_path('DIR_STRUCTURE' . '/PHP-CSS-Parser/lib/');
spl_autoload_register(function ($class) {
$file = preg_replace('#\\\|_(?!.+\\\)#','/', $class) . '.php';
if (stream_resolve_include_path($file)) {
require $file;
}
});
?>