未找到 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/
当然还有官方文档.
我遵循了创建框架的基本结构.然而,在加载应用程序时,我得到一个找不到类的错误.这与我放在 app.php 文件中的服务提供者直接相关.
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:
'LongestdriveCalendarCalendarServiceProvider'
我的文件夹结构是:
laravel/workbench/longestdrive/calendar/src/Longestdrive/Calendar
我的服务提供商有以下条目:
My service provider has the following entries:
<?php namespace LongestdriveCalendar;
use IlluminateSupportServiceProvider;
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?
产生错误的那一行是:
C:wampwwwgoogleapilaravelvendorlaravelframeworksrcIlluminateFoundationProviderRepository.php
感谢任何帮助
谢谢
更新:我按照工作台/包文件夹中的建议运行了作曲家更新,但响应没有更新.然后我在项目的根目录下运行 composer 并产生了一个错误:
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 'LongestdriveCalendarCalendarServiceProvider' not found
in C:wampwwwgoogleapilaravelvendorlaravelframeworksrcIlluminateFoundationProviderRe
pository.php on line 123
我之前可能发布了错误的错误行.完整的异常响应是:
I probably posted the wrong error line earlier. The full exception response is:
Class 'LongestdriveCalendarCalendarServiceProvider' not found
错误摘录:
* @param IlluminateFoundationApplication $app
* @param string $provider
* @return IlluminateSupportServiceProvider
*/
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.
相关文章