random425
random425

Reputation: 719

How to load a lib with composer?

I'm trying to install this lib: https://packagist.org/packages/clxcommunications/sdk-xms

Started by running this command: composer require clxcommunications/sdk-xms

Then created a file with this code:

<?php 

require 'vendor/autoload.php';
$client = \Clx\Xms\Client('myserviceplan', 'mytoken');

var_dump($client);
die();

But I get the following message:

( ! ) Fatal error: Call to undefined function Clx\Xms\Client() in C:\wamp\www\clxcommunications\index.php on line 7

This is my composer.json

{
    "require": {
        "clxcommunications/sdk-xms": "^1.1"
    }
}

And this is my autoload_psr4.php:

<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
    'Clx\\Xms\\' => array($vendorDir . '/clxcommunications/sdk-xms/src'),
);

What am I missing?
Thanks in advance.

Upvotes: 0

Views: 88

Answers (1)

jDolba
jDolba

Reputation: 411

you are missing php new keyword

$client = new \Clx\Xms\Client('myserviceplan', 'mytoken');

Upvotes: 1

Related Questions