ryndshn
ryndshn

Reputation: 701

How to 'use' a required dependency installed via composer PHP

I have installed the SoundCloud API wrapper into my project via composer using composer require ise/php-soundcloud 3.*. Now in my project, how do I use that? In my composer.json file I have

"require": {
        "laravel/framework": "5.0.*",
        "ise/php-soundcloud": "3.*",
        "njasm/soundcloud": "dev-master"
    },

The wrapper I am trying to 'use' is "ise/php-soundcloud": "3.*". The other SoundCloud related file is the wrapper I'm currently using, however I would like to switch over. I am able to 'use' that one by saying use Njasm\Soundcloud\SoundcloudFacade; at the top of whatever class I am trying to call it from. But for some reason I am not able to get the other one working, or recognized by my IDE (PhpStorm).

Upvotes: 0

Views: 81

Answers (1)

dops
dops

Reputation: 800

I teseted this with a fresh L5 install and got phpstorm to recognise it using use Soundcloud\Service;. Seemed to work fine. To figure it out I looked in the vendor/ise directory and has a look at the Service.php.

This showed it used the Soundcloud namespace. If I were to use this properly though I would probably use use Soundcloud\Service as SoundcloudService just so it woudl make sense.

This would allow me to use $myScService = new SoundcloudService($clientId, $clientSecret);

Upvotes: 1

Related Questions