PHPackages                             kartik-v/yii2-app-practical-b - 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. kartik-v/yii2-app-practical-b

ActiveProject[Framework](/categories/framework)

kartik-v/yii2-app-practical-b
=============================

Yii 2 Practical-B Application Template

v1.6.3(8y ago)312.7k8BSD-3-ClausePHPPHP &gt;=5.4.0

Since May 13Pushed 7y ago4 watchersCompare

[ Source](https://github.com/kartik-v/yii2-app-practical-b)[ Packagist](https://packagist.org/packages/kartik-v/yii2-app-practical-b)[ Docs](http://demos.krajee.com/app-practical-b)[ RSS](/packages/kartik-v-yii2-app-practical-b/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (9)Dependencies (9)Versions (10)Used By (0)

 [ ![Krajee Logo](https://camo.githubusercontent.com/4addfbb3869c3fc7d79befea4f06d9cf3655a686fb503df0da1d725859cfdef9/687474703a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f6b72616a65652d6c6f676f2d622e706e67) ](http://demos.krajee.com "Krajee Demos")
 Yii 2 Practical-B Project Template ---

 [ ![Donate](https://camo.githubusercontent.com/4af77d425ca202e55ab3d711b438e238ded194735bc345a019ac060e03e26227/687474703a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f646f6e6174652e706e67) ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DTP3NZQ6G2AYU "Donate via Paypal")
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#------------------------yii-2-practical-b-project-template--------------------)

[![Latest Stable Version](https://camo.githubusercontent.com/3aed4ff4e669b0ab4683b003181968ef30795a9c1de2af79b461c8d319c77152/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6170702d70726163746963616c2d622f762f737461626c652e737667)](https://packagist.org/packages/kartik-v/yii2-app-practical-b)[![License](https://camo.githubusercontent.com/2d9758619afbd82db56c0fd61d9f6b526df804ab2b12c3f6732e43d04706757f/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6170702d70726163746963616c2d622f6c6963656e73652e737667)](https://packagist.org/packages/kartik-v/yii2-app-practical-b)[![Total Downloads](https://camo.githubusercontent.com/b43fdd1abf963a00e7af8f27e1918d8e92f78927a2cd8500ac0fb109bc838b1f/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6170702d70726163746963616c2d622f646f776e6c6f6164732e737667)](https://packagist.org/packages/kartik-v/yii2-app-practical-b)[![Monthly Downloads](https://camo.githubusercontent.com/738faee7cdf27a928daef2a4b273c6b23767291b846411d4bd11272243c92757/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6170702d70726163746963616c2d622f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/kartik-v/yii2-app-practical-b)[![Daily Downloads](https://camo.githubusercontent.com/5f527944a712f0833869a5b76518d1dee9e4ca55f1edd295c80f70771ec3fd97/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6170702d70726163746963616c2d622f642f6461696c792e706e67)](https://packagist.org/packages/kartik-v/yii2-app-practical-b)

The Yii 2 Practical-B Application Template is a skeleton Yii 2 application based on the [yii2-basic template](https://github.com/yiisoft/yii2-app-basic/) best for rapidly creating small projects. The template allows a **practical** method to directly access the application from the app root.

The template contains the basic features including user login/logout and a contact page. It includes all commonly used configurations that would allow you to focus on adding new features to your application.

Why yii2-practical-b?
---------------------

[](#why-yii2-practical-b)

After installing a `app`, in the yii2-basic application you normally would access the frontend by:

```
http://domain/app/web

```

However, in many **practical** scenarios (especially on shared and single domain hosts) one would want their users to directly access the app as:

```
http://domain/app

```

The `yii2-app-practical-b` enables you to achieve just that by carefully moving and rearranging the bootstrap files and web components of frontend to work directly out of the app root. The `web` folder is entirely eliminated and one can directly access the application frontend this way:

```
http://domain/app

```

All other aspects of the app configuration remain the same as the **yii2-basic** app. The original `assets` folder in the approot is renamed to `assets_b`, while the `web/assets` folder moves to app root.

SOME KEY ADDITIONS
------------------

[](#some-key-additions)

1. The template has some security preconfigured for users with Apache web servers. It has a default `.htaccess` security configuration setup.
2. The template has prettyUrl enabled by default and the changes have been made to `.htaccess` as well as `urlManager`component config in the config directory.

DIRECTORY STRUCTURE
-------------------

[](#directory-structure)

```
    /                   contains the entry script and web resources
    assets/             contains the web runtime assets
    assets_b/           contains application assets such as JavaScript and CSS
    commands/           contains console commands (controllers)
    config/             contains application configurations
    controllers/        contains Web controller classes
    mail/               contains view files for e-mails
    models/             contains model classes
    runtime/            contains files generated during runtime
    tests/              contains various tests for the yii2-practical-b application
    vendor/             contains dependent 3rd-party packages
    views/              contains view files for the Web application

```

REQUIREMENTS
------------

[](#requirements)

The minimum requirement by this project template that your Web server supports PHP 5.4.0.

INSTALLATION
------------

[](#installation)

### Install via Composer

[](#install-via-composer)

If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix).

You can then install this project template using the following command:

```
php composer.phar global require "fxp/composer-asset-plugin:^1.3.1"
php composer.phar create-project --prefer-dist --stability=dev kartik-v/yii2-app-practical-b practical-b

```

Now you should be able to access the application through the following URL, assuming `practical-b` is the directory directly under the Web root.

```
http://localhost/practical-b

```

### Install from an Archive File

[](#install-from-an-archive-file)

Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to a directory named `basic` that is directly under the Web root.

Set cookie validation key in `config/web.php` file to some random secret string:

```
'request' => [
    // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
    'cookieValidationKey' => '',
],
```

You can then access the application through the following URL:

```
http://localhost/practical-b/

```

CONFIGURATION
-------------

[](#configuration)

### Database

[](#database)

Edit the file `config/db.php` with real data, for example:

```
return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2basic',
    'username' => 'root',
    'password' => '1234',
    'charset' => 'utf8',
];
```

**NOTES:**

- Yii won't create the database for you, this has to be done manually before you can access it.
- Check and edit the other files in the `config/` directory to customize your application as required.
- Refer to the README in the `tests` directory for information specific to basic application tests.

TESTING
-------

[](#testing)

Tests are located in `tests` directory. They are developed with [Codeception PHP Testing Framework](http://codeception.com/). By default there are 3 test suites:

- `unit`
- `functional`
- `acceptance`

Tests can be executed by running

```
vendor/bin/codecept run

```

The command above will execute unit and functional tests. Unit tests are testing the system components, while functional tests are for testing user interaction. Acceptance tests are disabled by default as they require additional setup since they perform testing in real browser.

### Running acceptance tests

[](#running--acceptance-tests)

To execute acceptance tests do the following:

1. Rename `tests/acceptance.suite.yml.example` to `tests/acceptance.suite.yml` to enable suite configuration
2. Replace `codeception/base` package in `composer.json` with `codeception/codeception` to install full featured version of Codeception
3. Update dependencies with Composer

    ```
    composer update

    ```
4. Download [Selenium Server](http://www.seleniumhq.org/download/) and launch it:

    ```
    java -jar ~/selenium-server-standalone-x.xx.x.jar

    ```

    In case of using Selenium Server 3.0 with Firefox browser since v48 or Google Chrome since v53 you must download [GeckoDriver](https://github.com/mozilla/geckodriver/releases) or [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/downloads) and launch Selenium with it:

    ```
    # for Firefox
    java -jar -Dwebdriver.gecko.driver=~/geckodriver ~/selenium-server-standalone-3.xx.x.jar

    # for Google Chrome
    java -jar -Dwebdriver.chrome.driver=~/chromedriver ~/selenium-server-standalone-3.xx.x.jar

    ```

    As an alternative way you can use already configured Docker container with older versions of Selenium and Firefox:

    ```
    docker run --net=host selenium/standalone-firefox:2.53.0

    ```
5. (Optional) Create `yii2_basic_tests` database and update it by applying migrations if you have them.

    ```
    tests/bin/yii migrate

    ```

    The database configuration can be found at `config/test_db.php`.
6. Start web server:

    ```
    tests/bin/yii serve

    ```
7. Now you can run all available tests

    ```
    # run all available tests
    vendor/bin/codecept run

    # run acceptance tests
    vendor/bin/codecept run acceptance

    # run only unit and functional tests
    vendor/bin/codecept run unit,functional

    ```

### Code coverage support

[](#code-coverage-support)

By default, code coverage is disabled in `codeception.yml` configuration file, you should uncomment needed rows to be able to collect code coverage. You can run your tests and collect coverage with the following command:

```
#collect coverage for all tests
vendor/bin/codecept run -- --coverage-html --coverage-xml

#collect coverage only for unit tests
vendor/bin/codecept run unit -- --coverage-html --coverage-xml

#collect coverage for unit and functional tests
vendor/bin/codecept run functional,unit -- --coverage-html --coverage-xml

```

You can see code coverage output under the `tests/_output` directory.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 97.3% 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

Every ~139 days

Recently: every ~231 days

Total

9

Last Release

3264d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3592619?v=4)[Kartik Visweswaran](/maintainers/kartik-v)[@kartik-v](https://github.com/kartik-v)

---

Top Contributors

[![kartik-v](https://avatars.githubusercontent.com/u/3592619?v=4)](https://github.com/kartik-v "kartik-v (36 commits)")[![CyanoFresh](https://avatars.githubusercontent.com/u/4249082?v=4)](https://github.com/CyanoFresh "CyanoFresh (1 commits)")

---

Tags

frameworkyii2basicapplication templatepractical-bpractical

### Embed Badge

![Health badge](/badges/kartik-v-yii2-app-practical-b/health.svg)

```
[![Health](https://phpackages.com/badges/kartik-v-yii2-app-practical-b/health.svg)](https://phpackages.com/packages/kartik-v-yii2-app-practical-b)
```

###  Alternatives

[nenad/yii2-basic-template

Improved Yii 2 Basic Application Template By Nenad Zivkovic

496.5k](/packages/nenad-yii2-basic-template)[kartik-v/yii2-app-practical

Yii 2 Practical Application Template

682.7k](/packages/kartik-v-yii2-app-practical)[kartik-v/yii2-app-practical-a

Yii 2 Practical A Application Template

363.7k](/packages/kartik-v-yii2-app-practical-a)[abhi1693/yii2-app-advanced-startup-kit

Yii 2 Practical Advanced Application Template (Startup Kit)

301.3k](/packages/abhi1693-yii2-app-advanced-startup-kit)[funson86/yii2-adminlte

Yii 2 Advanced Application Template with Adminlte Theme

1492.2k](/packages/funson86-yii2-adminlte)[yii2mod/base

Base application template for Yii2

531.3k](/packages/yii2mod-base)

PHPackages © 2026

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