Windows 7 64Bit、UwampローカルサーバーにLaravel 5.4最新vesionをインストールしました。Laravel ServiceProviderクラスがパッケージに見つかりません
私はすでに私はLaravelに登録しようとしています私の "カスタム" のパッケージに、以下のファイルを作成している:
パッケージ/カスタム/ timeshow/composer.json:
{
"name": "custom/timeshow",
"description": "Show Time in All Timezones",
"type": "composer-plugin",
"license": "GPL",
"authors": [
{
"name": "Test Author",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/",
"Custom\\Timeshow\\": "packages/custom/timeshow/src"
}
}
"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"
}
}
パッケージを\カスタム\ timeshow \ SRC \ TimeshowServiceProvider.php
<?php
namespace Custom\Timeshow;
use Illuminate\Support\ServiceProvider;
class TimeshowServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
include __DIR__.'/routes.php';
$this->app->make('Custom\Timeshow\TimeshowController');
}
}
のパッケージ\カスタム\ timeshow \ SRC \ TimeshowController.php
<?php
namespace Custom\Timeshow;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
class TimeshowController extends Controller
{
public function index($timezone)
{
echo Carbon::now($timezone)->toDateTimeString();
}
}
パッケージ\カスタム\ timeshow \ SRC \ routes.phpの
<?php
Route::get('timeshow/{timezone}', 'Custom\Timeshow\[email protected]');
も含まconfigに私のサービスプロバイダー/以下のようなapp.php:
Custom\Timeshow\TimeshowServiceProvider::class,
しかし、たとえすべてこの後、私は実行
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Custom\Timeshow\TimeshowServiceProvider' not found
は、誰かがそれを解決するには、これとassitで間違っているものを指摘することができます:コマンドphp artisan serve
は、私は以下のエラーを取得しますか?
'composer dump-autoload'コマンドを実行してみてください。 – Webinion
ちょっと...これは... php artisan vendor:publish .. –
何度も、 '-o'パラメータであっても、"生成されました...成功しました "と言われていますが、同じエラーが発生しました。 –