user3768725
user3768725

Reputation:

PHP not finding class in required file

I am using this php wrapper for multichain's json rpc api: https://github.com/Kunstmaan/libphp-multichain in a php file.

The error I see in apache error log is:

PHP Fatal error: Class 'MultichainClient' not found in /var/www/html/new.php on line 5

I'm not sure how I should adjust my code and the wrapper looks: My code:

<?php
       require_once 'libphp-multichain/src/be/kunstmaan/multichain/MultichainClient.php';
       require_once 'libphp-multichain/src/be/kunstmaan/multichain/MultichainHelper.php';
       $client = new MultichainClient("http://107.170.46.124:port",{usr},{pwd});
       print_r($client);
</code>

MultichainClient.php Code

Upvotes: 1

Views: 116

Answers (1)

Kristoffer Svanmark
Kristoffer Svanmark

Reputation: 778

The "MultichainClient" class is namespaced. You need to use the namespace as well as the class name when "calling" the class.

$client = new be\kunstmaan\multichain\MultichainClient();

Upvotes: 1

Related Questions