- 新建 composer.json 文件
{
"name": "company-name/project-name",
"type": "project",
"autoload": {
"files": [
"src/Helpers/helpers.php"
],
"psr-4": {
"project-namespace\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"project-test-namespace\\": "tests/"
}
},
"require-dev": {
"phpunit/phpunit": "~5.7"
}
}
- 新建 ./src/ProjectNameProvider.php
namespace ProjectNamespace;
use Illuminate\Support\ServiceProvider;
class ProjectNameProvider extends ServiceProvider
{
public function boot()
{
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
if ($this->app->runningInConsole()) {
$this->commands([
\ProjectNamespace\Commands\ProjectGenerate::class,
]);
}
$this->loadViewsFrom(__DIR__.'/views', 'projectView');
}
public function register()
{
$provides = [
'ProjectNamespace\Http\RouteServiceProvider',
];
foreach ($provides as $provider) {
$this->app->register($provider);
}
}
}
网友评论