maybeworks / yii2-app.bootstrap
Application runner for Yii PHP framework 2.0
Installs: 134
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2023-01-30 10:22:31 UTC
README
Application runner for Yii PHP framework 2.0
Installation
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.
Usage
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