composer.json / cakephp

composer.json / cakephp

我想使用:https://github.com/mikealmond/MusicBrainz 将 lib 复制到 myapp->vendor 文件夹中。使用作曲家安装了 Guzzle 并更新了作曲家。

use GuzzleHttp\Client;
use MusicBrainz\Filters\ArtistFilter;
use MusicBrainz\Filters\RecordingFilter;
use MusicBrainz\HttpAdapters\GuzzleHttpAdapter;
use MusicBrainz\MusicBrainz;

require __DIR__ . '/vendor/autoload.php';

自动加载不起作用。我尝试了很多东西,但不知道在 composer.json.

中写什么
Error: Class 'MusicBrainz\MusicBrainz' not found 

当我打电话时:

$brainz = new MusicBrainz(new GuzzleHttpAdapter(new Client()));

我试过 composer.json

"require-dev": {
     "vendor/MusicBrainz": "dev-master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url":  "https://github.com/mikealmond/MusicBrainz.git"
        }
    ],

然后作曲家更新... 我得到:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package src/musicbrainz could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

转到 Github 上的链接存储库页面。在根文件夹中,单击名为 composer.json 的文件。搜索带有 "name" 的行。右边的文字是你必须在 Composer 中使用的这个包的名称。

或者,转到 https://packagist.org and type something close to the actual name into the search field, like musicb. Something will be found: https://packagist.org/search/?q=musicb

无论如何,你会发现包名:mikealmond/musicbrainz.

现在转到命令行并键入:composer require mikealmond/musicbrainz。 Composer 将完成剩下的工作,包括下载 Guzzle,因为它被声明为依赖项。

在那一步之后,演示代码将起作用 - 或者至少不会因为缺少 类.

而失败