如何 'use' 通过 composer PHP 安装所需的依赖项

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

我已经使用 composer require ise/php-soundcloud 3.* 通过作曲家将 SoundCloud API 包装器安装到我的项目中。现在在我的项目中,我该如何使用它?在我的 composer.json 文件中我有

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

我正在尝试 'use' 的包装器是 "ise/php-soundcloud": "3.*"。另一个与 SoundCloud 相关的文件是我目前正在使用的包装器,但我想切换过来。我可以 'use' 通过在我试图从中调用它的任何 class 的顶部说 use Njasm\Soundcloud\SoundcloudFacade; 来实现。但出于某种原因,我无法让另一个工作,或者被我的 IDE (PhpStorm) 识别。

我通过全新的 L5 安装对此进行了测试,并让 phpstorm 使用 use Soundcloud\Service; 识别它。似乎工作正常。为了弄清楚,我查看了 vendor/ise 目录并查看了 Service.php.

这表明它使用了 Soundcloud 命名空间。如果我要正确使用它,虽然我可能会使用 use Soundcloud\Service as SoundcloudService 这样它就有意义了。

这将允许我使用 $myScService = new SoundcloudService($clientId, $clientSecret);