Question

How am I supposed to use the Solarium Library https://packagist.org/packages/solarium/solarium

With PHP Composer? http://getcomposer.org/

  • I ran

composer require solarium/solarium

  • It installed properly then I added to my php file

include_once './vendor/autoload.php';

  • Then how do I initialize the Autoloader? Before composer I would perform the following require and all the functions would then be available.

require_once(dirname(__FILE__) . '/../Solarium/Autoloader.php');

  • I tried the following but it gives me Fatal error: Cannot redeclare class Solarium\Autoloader on Solarium\Autoloader.php on line 53

new Solarium\Autoloader();

Was it helpful?

Solution

The point of an autoloader is that you do not have to require_once files before using them. Just call new Solarium_Client(); after including the Composer autoload.php file, including it initializes the autoloader already.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top