找不到Laravel 4工作台类 [英] Laravel 4 workbench class not found

查看:71
本文介绍了找不到Laravel 4工作台类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在laravel 4中开发一个软件包,这是我第一次尝试使用软件包. 我找到了一些我尝试遵循的教程:

I'm trying to develop a package in laravel 4 - my first attempt at a package. I found a couple of tutorials which I've tried to follow:

http://jasonlewis.me/article/laravel-4-develop-packages-using-the-workbench

http://culttt.com/2013/06/24/creating-a-laravel-4-package/

,当然还有官方文档中的内容.

and of course in the official documentation.

我遵循了基本结构来创建框架.但是,在加载应用程序时,出现未找到类错误.这直接与我放置在app.php文件中的serviceprovider有关.

I've followed the basic structure to create the framework. However on loading the app I get a class not found error. This relates directly to the serviceprovider I have placed in the app.php file.

这是我在providers数组中的条目:

here's my entry in the providers array:

'Longestdrive\Calendar\CalendarServiceProvider'

我的文件夹结构是:

 laravel/workbench/longestdrive/calendar/src/Longestdrive/Calendar

我的服务提供商有以下条目:

My service provider has the following entries:

<?php namespace Longestdrive\Calendar;

use Illuminate\Support\ServiceProvider;

class CalendarServiceProvider extends ServiceProvider {

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('longestdrive/calendar');
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return array();
    }

}

我已经仔细检查了拼写,并从项目的根目录和程序包的根目录运行了composer dump-autoload.

I've double checked to spelling and ran a composer dump-autoload both from the root of the project and the root of the package.

我已经没有解决课堂上的想法的地方了,没有发现我哪里出错了吗?

I've run out of ideas for solving the class not found any ideas where I've gone wrong?

产生错误的行是这一行:

The line producing the error is this one:

C:\wamp\www\googleapi\laravel\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php

任何帮助表示赞赏

谢谢

更新: 我按照工作台/软件包文件夹中的建议运行了作曲家更新,但没有任何响应可更新.然后,我在项目的根部运行了作曲家,并产生了一个错误:

Update: I ran a composer update as suggested in the workbench/package folder with a response nothing to update. I then ran composer at the root of the project and an error was produced:

[RuntimeException]
  Error Output: PHP Fatal error:  Class 'Longestdrive\Calendar\CalendarServiceProvider' not found
   in C:\wamp\www\googleapi\laravel\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRe
  pository.php on line 123

我可能早些时候发布了错误的错误行.完整的异常响应为:

I probably posted the wrong error line earlier. The full exception response is:

Class 'Longestdrive\Calendar\CalendarServiceProvider' not found

错误提取:

* @param \Illuminate\Foundation\Application $app
* @param string $provider
* @return \Illuminate\Support\ServiceProvider
*/
public function createProvider(Application $app, $provider)
{
return new $provider($app);
}

我认为与服务提供商加载程序没有找到CalendarServiceProvider有关?

which I assume relates to the service provider loader not finding the CalendarServiceProvider?

推荐答案

我发现从workbench/[vendor]/[package]文件夹中运行composer install可以解决此问题.

I found that running composer install from within the workbench/[vendor]/[package] folder solved the problem.

这篇关于找不到Laravel 4工作台类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆