문제

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();

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top