duan201444 2018-04-06 23:08
浏览 73
已采纳

找不到FatalErrorException类'Codedge \ Fpdf \ FpdfServiceProvider'

The question is this, I have a development in Laravel 5.0 and developed a small module to create a pdf using the FPDF library, the issue is that my local server works correctly, but when I upload the files to my web server I throw the following error:

FatalErrorException in ProviderRepository.php line 150: Class 'Codedge\Fpdf\FpdfServiceProvider' not found

I did everything what the documentation indicates, nevertheless it still does not work correctly, I leave the code for its analysis

composer.json

{
  "name" : "laravel/laravel",
  "description" : "The Laravel Framework.",
  "keywords": ["framework", "laravel"],
  "license": "MIT",
  "type": "project",
  "require" : {
    "laravel/framework" : "5.0.*",
    "illuminate/html" : "~5.0",
    "yajra/laravel-datatables-oracle" : ">=v4.0.1",
    "doctrine/dbal": "~2.5",
    "laracasts/testdummy": "~2.0",
    "laracasts/flash": "~1.3",
    "barryvdh/laravel-debugbar": "~2.0",
    "khill/lavacharts": "3.0.x-dev",
    "conekta/conekta-php": "dev-master",
    "codedge/laravel-fpdf": "^1.2",
    "anouar/fpdf": "^2.0"
  },
  "require-dev" : {
    "phpunit/phpunit" : "~4.0",
    "phpspec/phpspec" : "~2.1",
    "laracasts/generators": "~1.0",
    "anouar/fpdf": "1.0.2"
  },
  "autoload": {
    "classmap": [
      "database"
    ],
    "psr-4": {
      "App\\": "app/"
    }
  },
  "autoload-dev": {
    "classmap": [
      "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 -r \"copy('.env.example', '.env');\"",
      "php artisan key:generate"
    ]
  },
  "config": {
    "preferred-install": "dist"
  }
}

app.php

'providers' => [
        /*
         * Application Service Providers...
         */
        Codedge\Fpdf\FpdfServiceProvider::class,
    ],
'aliases' => [
        'Fpdf' => Codedge\Fpdf\Facades\Fpdf::class,
    ],

According to the documentation I did what this page told me

https://github.com/codedge/laravel-fpdf

In local it works without any problem, but online it sends the error that comments

Any help

  • 写回答

1条回答 默认 最新

  • dsieyx2015 2018-04-07 03:02
    关注

    Try to remove service provider and alias from config/app.php, then run:

    composer update
    php artisan vendor:publish --provider="Codedge\Fpdf\FpdfServiceProvider" --tag=config
    composer dump-autoload
    

    Then add service provider and alias back to config/app.php.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?