jaco6
jaco6

Reputation: 31

Using composer installed library, class not found error

I used composer to download a php bitcoin library to play around with. https://github.com/phramz/php-bitcoin-api This one specifically.

Anyways, everytime I try to use the library with

use Phramz\Bitcoin\Api\Connection\BuzzConnection;
use Phramz\Bitcoin\Api\BitcoindClient;

I get

Interface 'Phramz\Bitcoin\Api\Client' not found in /root/vendor/phramz/php-bitcoin-api/src/Phramz/Bitcoin/Api/BitcoindClient.php

whenever I try to run any test code. I really want to play around with this library but Im sort of a newbie php programmer and this is frustrating me. Any help would be appreciated!

Upvotes: 2

Views: 4192

Answers (2)

vanduc1102
vanduc1102

Reputation: 6255

I had the kind of issue when I installed a new lib, and i just deployed the new lib to server only as I was new to PHP, it took me hours to figure out that the vendor/composer folder is updated when we install a new lib.

So if your server doesn't support composer install , upload the whole vendor folder to your server is the way.

Upvotes: 0

Eugene C
Eugene C

Reputation: 540

Make sure you require vendor/autoload.php as described in Composer documentation.

If Composer's vendor directory is not located in the current directory you'll need to use an absolute path or something like:

<?php
require_once(__DIR__."/../../vendor/autoload.php");

Upvotes: 4

Related Questions