找不到拉拉维尔自定义作曲家 libaray 类



我用作曲家创建了我的自定义php库。此库的composer.json如下所示:

{
    "name": "singboard/platform-fetcher",
    "description": "Fetch reviews from third part platforms.",
    "license": "proprietary",
    "version": "0.1.0-dev",
    "authors": [
       [...]
    ],
    "type": "library",
    "require": {
        [...]
    },
    "require-dev": {
        [...]
    },
    "autoload": {
        "psr-4": {
            "Singboard\PlatformFetcher\": "src/"
        }
    }
}

作曲家库的文件夹结构如下:

├── composer.json
├── composer.lock
└── src
    └── FacebookFetcher.php

现在我已经把这个库包含在我的laravel项目中。在我的 laravel 项目的composer.json中,我添加了以下内容:

 "repositories": [
        {
            "type": "package",
            "package": {
                "name": "singboard/platform-fetcher",
                "version": "0.1.0-dev",
                "type": "library",
                "source": {
                    "url": "xxx-xxx",
                    "type": "git",
                    "reference": "master"
                }
            }
        }
    ],
"require": {
        "singboard/platform-fetcher": "0.1.0-dev"
    },

问题是当我尝试调用FacebookFetcher.php类时,我收到消息Class 'SingboardPlatformFetcherFacebookFetcher' not found。问题出在哪里?

如作曲家文档中所报告的那样,这不是包含自定义远程库的正确方法。您应该通过以下方式实现您的库:

{
    "require": {
        "vendor/my-private-repo": "dev-master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url":  "git@bitbucket.org:vendor/my-private-repo.git"
        }
    ]
}

相关内容

  • 没有找到相关文章

最新更新