Application runner for Yii PHP framework 2.0
The preferred way to install this extension is through composer.
Either run
php composer.phar require "maybeworks/yii2-app.bootstrap" "*"
or add
"maybeworks/yii2-app.bootstrap" : "*"
to the require section of your application's composer.json
file.
Alternative project structure
.
├── apps
│ ├── backend
│ │ └── ...
│ ├── console
│ │ └── ...
│ └── frontend
│ └── ...
├── common
│ └── ...
├── config
│ ├── backend.php
│ ├── bootstrap.php
│ ├── common.php
│ ├── console.php
│ ├── frontend.php
│ ├── local-example.php
│ └── local.php
├── db
│ ├── fixtures
│ │ └── ...
│ └── migrations
│ └── ...
├── runtime
│ └── ...
├── vendor
│ └── ...
├── web
│ ├── backend
│ │ ├── favicon.ico
│ │ └── index.php
│ ├── frontend
│ │ ├── favicon.ico
│ │ └── index.php
│ └── static
│ └── assets
│ └── ...
└── yii
Local config example - config/local.php
<?php
/**
* @var $this AppBootstrap
*/
return [
'common' => [
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2-app',
'username' => 'root',
'password' => '',
],
'mailer' => [
'useFileTransport' => true,
],
],
],
'backend' => [],
'frontend' => [],
'bootstrap' => [
'debug' => true,
'env' => $this::ENV_DEV,
'aliases' => [
'web_frontend' => 'http://site.local',
'web_backend' => 'http://admin.site.local',
'web_static' => 'http://static.site.local'
]
],
];
Index file for main web point - web/frontend/index.php
<?php
require dirname(dirname(__DIR__)) . '/vendor/maybeworks/yii2-app.bootstrap/AppBootstrap.php';
(new AppBootstrap(
[
'name' => 'frontend',
'type' => AppBootstrap::APP_WEB,
'baseDir' => dirname(dirname(__DIR__)),
'vendorDir' => dirname(dirname(__DIR__)) . '/vendor',
'bootConfig' => dirname(dirname(__DIR__)) . '/config/bootstrap.php'
]
))->run();
yii.php for cmd
#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/maybeworks/yii2-app.bootstrap/AppBootstrap.php';
exit(
(new AppBootstrap(
[
'name' => 'console',
'type' => AppBootstrap::APP_CONSOLE,
'baseDir' => __DIR__,
'vendorDir' => __DIR__ . '/vendor',
'bootConfig' => __DIR__ . '/config/bootstrap.php'
]
))->run()
);
Nothing is impossible, limit exists only in the minds of...
maybe.works