php - How to require a package installed via Composer -


i installed emanueleminotto/simple-html-dom via composer.

how can use classes package without getting error?

note: use xampp run php scripts.

error message:

php fatal error: uncaught error: class 'simple_html_dom' not found in c:\xampp\htdocs\practice\php\scrape_1.php:3 stack trace:

0 {main}

thrown in c:\xampp\htdocs\practice\php\scrape_1.php on line 3

fatal error: uncaught error: class 'simple_html_dom' not found in c:\xampp\htdocs\practice\php\scrape_1.php:3 stack trace:

0 {main}

thrown in c:\xampp\htdocs\practice\php\scrape_1.php on line 3

after running

$ composer install 

require autoloader generated in vendor/autoload.php @ top of script file (or, web application, in front controller).

then have autoloaded classes available in script.

<?php      require_once __dir__ . '/vendor/autoload.php';  $htmldom = new simple_html_dom_node(); 

for reference, see https://getcomposer.org/doc/01-basic-usage.md#autoloading.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -