简体   繁体   English

Laravel:ServiceProvider问题 错误:在第#行的bootstrap / compiled.php中找不到类“…ServiceProvider”

[英]Laravel: Issues with ServiceProvider | Error: Class '…ServiceProvider' not found in bootstrap/compiled.php on line #

I have been working on the same app for a little bit now, and I am moving it over to Laravel. 我已经在同一个应用程序上工作了一段时间,现在将其移至Laravel。 This is not only my first experience with Laravel, but my first time using a PHP framework. 这不仅是我第一次使用Laravel,还是我第一次使用PHP框架。 It is awesome so far. 到目前为止很棒。

I have run into a problem in my testing, I am getting an error: Error Output: PHP Fatal error: Class 'my-app/Repositories/RepositoryServiceProvider' not found in /var/www/laravel/bootstrap/compiled.php on line 4259 我在测试中遇到问题,出现错误: Error Output: PHP Fatal error: Class 'my-app/Repositories/RepositoryServiceProvider' not found in /var/www/laravel/bootstrap/compiled.php on line 4259

I am wondering what causes this error and how I can fix it . 我想知道是什么原因导致此错误,以及如何解决该错误。 It gives me the direct line that is problematic. 它给了我有问题的直接电话。 But I have no idea how to solve this issue. 但是我不知道如何解决这个问题。

I have tried a number of solutions including 我尝试了许多解决方案,包括

composer install
composer update
composer dump-autoload

and others as well. 和其他。

I have also attempted deleting the compiled.php file all together, but then it trips the same error on a different file. 我也尝试过一起删除所有compiled.php文件,但是随后它在另一个文件上触发了相同的错误。 What is it causing this error, and how can I go about debugging it? 是什么导致此错误,如何进行调试?

This is my RepositoryServiceProvider.php file that is being problematic: 这是我有问题的RepositoryServiceProvider.php文件:

<?php namespace my-app\Repositories;

use Invite;
use Illuminate\Support\ServiceProvider;
use my-app\Repositories\Invite\EloquentInviteRepository;

class RepositoryServiceProvider extends ServiceProvider {

 /**
   * Register the Invite Repository
   *
   * @return void
   */
  public function registerInviteRepository()
  {
    $this->app->bind('my-app\Repositories\Invite\InviteRepository', function($app)
  {
      return new EloquentInviteRepository( new Invite );
  });
}

composer.json composer.json

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
    "laravel/framework": "4.2.*",
    "way/generators": "dev-master"
},
"autoload": {
    "classmap": [
        "app/commands",
        "app/controllers",
        "app/models",
        "app/database/migrations",
        "app/database/seeds",
        "app/tests/TestCase.php"
    ]
},
"scripts": {
    "post-install-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ]
},
"config": {
    "preferred-install": "dist"
},
"minimum-stability": "stable"
}

This is the specific line in compiled.php that is giving the issue: 这是在compiled.php中给出问题的特定行:

{
    return new $provider($app);
}

You guys have been a huge resource in the past. 你们在过去一直是巨大的资源。

I've experienced almost 24 hours of coding downtime because of this probably simple problem, and I've restored and rebuilt twice, only getting back to this error. 由于这个可能很简单的问题,我经历了将近24小时的代码停机时间,并且我恢复并重建了两次,仅回到了此错误。

Thanks for help in advance!! 预先感谢您的帮助!

您是否尝试过在/app/cofig/app.php的'providers'数组下注册您的提供者,然后做一个composer dump-autoload -o

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM