PHPackages                             nenad/yii2-basic-template - 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. nenad/yii2-basic-template

ActiveProject[Framework](/categories/framework)

nenad/yii2-basic-template
=========================

Improved Yii 2 Basic Application Template By Nenad Zivkovic

2.3.0(10y ago)466.5k26[4 issues](https://github.com/nenad-zivkovic/yii2-basic-template/issues)[1 PRs](https://github.com/nenad-zivkovic/yii2-basic-template/pulls)BSD-3-ClausePHPPHP &gt;=5.4.0

Since Feb 21Pushed 7y ago11 watchersCompare

[ Source](https://github.com/nenad-zivkovic/yii2-basic-template)[ Packagist](https://packagist.org/packages/nenad/yii2-basic-template)[ RSS](/packages/nenad-yii2-basic-template/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (10)Versions (2)Used By (0)

yii2-basic-template
===================

[](#yii2-basic-template)

Yii2-basic-template is based on yii2-app-basic created by yii2 core developers, but it also uses some of the features presented in their advanced template too. There are several upgrades made to this template.

1. This template comes with almost all features that default yii2-app-advanced has.
2. It has additional features listed in the next section of this guide.
3. Application structure has been changed to be 'shared hosting friendly'.

Features
--------

[](#features)

- Signup with/without account activation
    - You can chose whether or not new users need to activate their account using email account activation system before they can log in.
- Login using email/password or username/password combo.
    - You can chose how users will login into system. They can log in either by using their username|password combo or email|password.
- Rbac tables are installed with other migrations when you run `yii migrate` command.
    - RbacController's init() action will insert 5 roles and 2 permissions in our rbac tables created by migration.
    - Roles can be easily assigned to users by administrators of the site.
- Session data is stored in \_protected/session folder.
- System setting are stored in config/params.php file.
- Theming is supported out of the box.
- Translation is supported out of the box.
- Administrator+ roles can manage users.
- Password strength validation and strength meter are included out of the box.
- Simple role management is included out of the box.
- Code is heavily commented out.

Installation
------------

[](#installation)

> I am assuming that you know how to: install and use Composer, and install additional packages/drivers that may be needed for you to run everything on your system. In case you are new to all of this, you can check my guides for installing default yii2 application templates, provided by yii2 developers, on Windows 8 and Ubuntu based Linux operating systems, posted on [www.freetuts.org](http://www.freetuts.org).

1. Create database that you are going to use for your application (you can use phpMyAdmin or any other tool that you like).
2. Now open up your console and `cd` to your web root directory, for example: `cd /var/www/html/`
3. Run the Composer `create-project` command:

    `composer create-project nenad/yii2-basic-template basic`
4. Now you need to tell your application to use database that you have previously created. Open up db.php config file in `basic/_protected/config/db.php` and adjust your connection credentials.
5. Back to the console. Inside your newly installed application, `cd` to the `_protected` folder.
6. Execute yii migration command that will install necessary database tables:

    `./yii migrate` or if you are on Windows `yii migrate`
7. Execute *rbac* controller *init* action that will populate our rbac tables with default roles and permissions:

    `./yii rbac/init` or if you are on Windows `yii rbac/init`

You are done, you can start your application in your browser.

> Note: First user that signs up will get 'theCreator' (super admin) role. This is supposed to be you. This role have all possible super powers :-) . Every other user that signs up after the first one will NOT get any role by default. This is because authenticated user (@ by default) is same like our member role.

Testing
-------

[](#testing)

If you want to run tests you should create additional database that will be used to store your testing data. Usually testing database will have the same structure like the production one. I am assuming that you have Codeception installed globally, and that you know how to use it. Here is how you can set up everything easily:

1. Let's say that you have created database called `basic`. Go create the testing one called `basic_tests`.
2. Inside your `db.php` config file change database you are going to use to `basic_tests`.
3. Open up your console and `cd` to the `_protected` folder of your application.
4. Run the migrations again: `./yii migrate` or if you are on Windows `yii migrate`
5. Run rbac/init again: `./yii rbac/init` or if you are on Windows `yii rbac/init`
6. Now you can tell your application to use your `basic` database again instead of `basic_tests`. Adjust your `db.php` config file again.
7. Now you are ready to tell Codeception to use `basic_tests` database.

    Inside: `_protected/tests/codeception/config/config.php` file tell your `db` to use `basic_tests` database.
8. Start your php server inside the root of your application: `php -S localhost:8080`(if the name of your application is *basic*, then root is `basic` folder)
9. Move to `_protected/tests` , run `codecept build` and then run your tests.

Directory structure
-------------------

[](#directory-structure)

```
_protected
    assets/              contains assets definition
    components/          contains custom made application components
    config/              contains application configurations
    console              contains console commands (controllers and migrations)
    controllers/         contains Web controller classes
    helpers/             contains helper classes
    mail/                contains view files for e-mails
    models/              contains model classes
    rbac/                contains role based access control classes
    runtime/             contains files generated during runtime
    tests/               contains various tests for the basic application
    translations/        contains application translations
    views/               contains view files for the Web application
    widgets/             contains widgets
assets                   contains application assets generated during runtime
themes                   contains your themes
uploads                  contains various files that can be uploaded by application users

```

Version 2.3.0 changes
---------------------

[](#version-230-changes)

1. Adds `components` folder to the \_protected folder, and `Aliases` class in it.
2. Articles have been removed from the template.
3. Themes have been changed.
4. A lot of code improvements have been done.
5. More translation messages have been added.

Password strength guide
-----------------------

[](#password-strength-guide)

Since 1.1.1 version has been released, password strength extension has been included as a core part of improved templates. Usage is very simple:

In our signup, user create/update and password reset forms password strength meter is always displayed when users are entering their password. This will give them visual representation of their password strength.
But this is not all. As The Creator you have option in your settings "Force Strong Password" that you can use. If you turn it on, users will be forced to use strong passwords according to preset you chose. For example if you use normal preset, users will be forced to use at least 8 characters long password, with at least one upper-case and one lower-case letter, plus at least one digit.

Choosing presets:

By default normal preset is used for signup and user create/update forms. For password reset we are using 'simple' preset. If you want to customize which presets is used, see SignupForm model, User model and ResetPasswordForm model. You will see rules declared for using strong passwords. Presets are located in `vendor/kartik-v/yii2-password/presets.php`. You can chose some other preset declared in presets.php, or create new ones.

[![Yii2](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)](http://www.yiiframework.com/)

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3784d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/da237b2cc3ea21b647cb047bb653ca9c4f7341a07768eb83e6ee561c818cce03?d=identicon)[nenad](/maintainers/nenad)

---

Top Contributors

[![nenad-zivkovic](https://avatars.githubusercontent.com/u/8584827?v=4)](https://github.com/nenad-zivkovic "nenad-zivkovic (121 commits)")

---

Tags

frameworkyii2improvedbasicapplication templatenenad

### Embed Badge

![Health badge](/badges/nenad-yii2-basic-template/health.svg)

```
[![Health](https://phpackages.com/badges/nenad-yii2-basic-template/health.svg)](https://phpackages.com/packages/nenad-yii2-basic-template)
```

###  Alternatives

[nenad/yii2-advanced-template

Improved Yii 2 Advanced Application Template By Nenad Zivkovic

9111.1k](/packages/nenad-yii2-advanced-template)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.8k58](/packages/skeeks-cms)[kartik-v/yii2-app-practical-b

Yii 2 Practical-B Application Template

312.7k](/packages/kartik-v-yii2-app-practical-b)[funson86/yii2-adminlte

Yii 2 Advanced Application Template with Adminlte Theme

1492.2k](/packages/funson86-yii2-adminlte)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
