PHPackages                             muvo/yii2-boilerplate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. muvo/yii2-boilerplate

ActiveProject[Framework](/categories/framework)

muvo/yii2-boilerplate
=====================

An Yii2-based boilerplate

1.0.1(8y ago)028PHPPHP &gt;=7.0

Since Jan 7Pushed 7y ago1 watchersCompare

[ Source](https://github.com/MuVO/yii2-boilerplate)[ Packagist](https://packagist.org/packages/muvo/yii2-boilerplate)[ RSS](/packages/muvo-yii2-boilerplate/feed)WikiDiscussions develop Synced yesterday

READMEChangelogDependencies (6)Versions (3)Used By (0)

Yii2 boilerplate
================

[](#yii2-boilerplate)

Prerequisites
=============

[](#prerequisites)

1. PHP &gt;=7
2. [composer](https://getcomposer.org) installed

Installation
============

[](#installation)

1. Run: ```
    $ composer create-project muvo/yii2-boilerplate
    ```

PROFIT!
=======

[](#profit)

You can continue to make your best Yii2-application! :)

### Some additional notices about files and directories

[](#some-additional-notices-about-files-and-directories)

- [`.env`](./.env): In this file you can predefine environment variables for application in format `KEY="SOME VALUE"` *(per one key-value pair in string)*
- [`app/themes`](./app/themes): In this directory you can place your application's themes *(assets, views, layouts, …)*For example, I *recommend* following structure:
    - `app/themes/admin/assets`: put in this direcory all required assets for your application, like js, css, etc…
    - Add your own asset-bundle:
        1. Create file `app/themes/admin/AssetBundle.php`. That class-file extends a `yii\web\AssetBundle`
        2. In this class you should define a `$sourcePath = '@app/themes/admin/assets'`
        3. Define a your theme-specific `$js` and `$css` properties
        4. Then you can register your asset-bundle in view/layout, like ``. When your asset-bundle registers in a view, application will **automatically** publish contents of `app/themes/admin/assets`-directory in public `@webroot` and injects JS and CSS scripts in your view(layout)
    - Create directory for layouts and views: `app/themes/admin/views/layouts`
    - Look more information about [Yii theming](http://www.yiiframework.com/doc-2.0/guide-output-theming.html)
- `app\models`: Put there your data-models, for example ActiveRecord models for interact with database
- `app\modules`: There you can place your separate [Yii-modules](http://www.yiiframework.com/doc-2.0/guide-structure-modules.html), like user's panel, admin's panel, etc…
- `lib`: This is arbitrary directory for development separate custom components. Classes to be placed there must be in namespace `MuVO\Yii2`. For example, if I want to create `Connector` for `SomeComponent`, I should:
    1. Create file `lib/SomeComponent/Connector.php` with following content: ```
