start.php
中强制优先加载本地的 ./support/helpers.php
。使用 webman/console
时,需要对 ./webman
可执行文件同样做如下更改,优先加载 ./support/helpers.php
。#!/usr/bin/env php
<?php
// 避免加载了 laravel/illuminate/foundation/helper.php 导致无法控制顺序的函数重定义报错
require_once __DIR__ . '/support/helpers.php'; // <- here.
require_once __DIR__ . '/vendor/autoload.php';
support\App::run();
composer.json
中 autoload.files
的 ./support/helpers.php
文件加载{
...
"autoload": {
"psr-4": {
...
"": "./",
"App\\": "./app"
},
"files": [] // <- here.
},
...
}
composer require mouyong/webman-laravel:dev-master
在 config/app.php 中增加如下内容
return [
...
'name' => 'webman',
'env' => 'development',
'providers' => array_filter(array_map(function ($item) {
if (class_exists($item)) {
return $item;
}
}, [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/**
* 你安装的 laravel 扩展包
*/
// \Fresns\PluginManager\Providers\PluginServiceProvider::class,
/**
* 项目的扩展包
*/
\App\Providers\AppServiceProvider::class,
])),
'aliases' => \Illuminate\Support\Facades\Facade::defaultAliases()->merge([
// 'ExampleClass' => App\Example\ExampleClass::class,
])->toArray(),
];
composer.json
"scripts": {
// 初始化 laravel-zero/illuminate 与相关配置
"post-autoload-dump": [
"MouYong\\WebmanLaravel\\ComposerScripts::postAutoloadDump"
],
...
}
config/bootstrap.php
return [
\MouYong\WebmanLaravel\LaravelBootstrap::class,
...
];
php artisan
composer require illuminate/auth # 参考 `laravel` 官方配置 `config` 目录,增加相关的配置项:https://github.com/laravel/laravel