分叉式供应商中找不到Laravel服务提供商类

时间:2017-11-14 00:29:16

标签: laravel laravel-5 composer-php laravel-5.4

我正在开发一个在Laravel中运行良好的回购。当我分配回购时,我现在得到这个错误:

[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'DevIT\Hasoffers\Laravel\Providers\HasoffersServiceProvider' not found

我尝试在app.php中注释掉提供者行,然后运行这些,然后取消注释该行,但这些没有帮助:

composer dump-autoload
php artisan clear-compiled
php artisan optimize

这是composer.json中的配置:

"require": {
    "devit/hasoffers-php-client": "dev-master",
    "devit/hasoffers-laravel-client": "dev-master"
},
"repositories": [
    {
        "type": "package",
        "package": {
            "name": "devit/hasoffers-php-client",
            "version": "dev-master",
            "source": {
                "url": "https://github.com/ecomevo/hasoffers-php.git",
                "type": "git",
                "reference": "master"
            }
        }
    },
    {
        "type": "package",
        "package": {
            "name": "devit/hasoffers-laravel-client",
            "version": "dev-master",
            "source": {
                "url": "https://github.com/ecomevo/hasoffers-laravel.git",
                "type": "git",
                "reference": "master"
            }
        }
    }
],

如果我导航到供应商目录,那么包就在那里,作曲家声称它在最新更新期间将其带入了。

我在这里弄错了什么?

1 个答案:

答案 0 :(得分:1)

你的作曲家文件正在使用package repositories,它不会读取被拉入的包的component displayName="test" output="false" hint="blah blah description..." { // beware of `default`--it doesn't do what you might think. // it's ignored unless you use ORM property type="numeric" name="age" default="10" hint="blah blah description..." propMetadata2="property metadata2"; remote query function test( numeric limitFrom=0 hint="blah blah description...", numeric limitBy=0 hint="blah blah description..." ) hint="I am a test function" { return queryNew(""); } } 文件。由于PSR-4自动加载是在那些composer.json文件中定义的,所以没有设置,你的班级没有找到。

您可以将自动加载功能添加到软件包定义中,但最好的办法是使用vcs repository type,以便尊重他们的composer.json文件。

您的作曲家文件应如下所示:

composer.json

由于您已使用以前的方法提取了这些包,因此在进行作曲家更新之前可能需要清除您的编辑器缓存:

"require": {
    "devit/hasoffers-php-client": "dev-master",
    "devit/hasoffers-laravel-client": "dev-master"
},
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/ecomevo/hasoffers-php"
    },
    {
        "type": "vcs",
        "url": "https://github.com/ecomevo/hasoffers-laravel"
    }
],