PHPackages                             2amigos/yii2-app-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. 2amigos/yii2-app-template

AbandonedArchivedProject[Framework](/categories/framework)

2amigos/yii2-app-template
=========================

Yii 2 Project Template

1.0.9(8y ago)531.3k19[7 issues](https://github.com/2amigos/yii2-app-template/issues)[1 PRs](https://github.com/2amigos/yii2-app-template/pulls)BSD-3-ClausePHPPHP &gt;=5.4.0

Since May 8Pushed 5y ago2 watchersCompare

[ Source](https://github.com/2amigos/yii2-app-template)[ Packagist](https://packagist.org/packages/2amigos/yii2-app-template)[ Docs](https://github.com/2amigos/yii2-app-template)[ RSS](/packages/2amigos-yii2-app-template/feed)WikiDiscussions master Synced yesterday

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

Yii 2 Project Template With ConfigKit
=====================================

[](#yii-2-project-template-with-configkit)

[![Packagist Version](https://camo.githubusercontent.com/e3f4fccef99a2e5e8e9162d160cefadbc987a5447a00b1faa4b36ff5f89043c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f32616d69676f732f796969322d6170702d74656d706c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/2amigos/yii2-app-template)[![Latest Stable Version](https://camo.githubusercontent.com/fca258a6aee79f9978c61f98790089835f2916480d17be60dc383535a6409114/68747470733a2f2f706f7365722e707567782e6f72672f32616d69676f732f796969322d6170702d74656d706c6174652f76657273696f6e)](https://packagist.org/packages/2amigos/yii2-app-template)[![Total Downloads](https://camo.githubusercontent.com/4023d0970fe204c9138d32b13cc6b6569c90fd97f1c9a36d9ee92f18fd13ad28/68747470733a2f2f706f7365722e707567782e6f72672f32616d69676f732f796969322d6170702d74656d706c6174652f646f776e6c6f616473)](https://packagist.org/packages/2amigos/yii2-app-template)

This project is an example of what can be done with .

It's a proposed application project template for Yii2 projects. This new template is perfect for projects of any size. Even though the Yii community recommends the usage of the advanced project template, but if we look carefully at that template you'll soon realize that what it has is simply three applications in one: `backend / frontend / console`. So, what's the difference between that template and this one? A shared common folder and another app? What stops you from doing the same with this type of starting point architecture? Right, absolutely nothing.

Our knowledge and experience with Yii has taught us that the advanced template is not really necessary to build anything that this template cannot also handle. Do you wish to create a super-admin application? Then simply add another folder wherever you wish and inject the shared resources from the `src` folder, the `business` or `domain` logic.

If you are using our proposed template then please take into consideration some recommendations from us:

- Make sure your application logic **is not within** your models. Yes, avoid that MVC pattern recommendation to have thick models. You will surely end up with many God objects (monolithic models with huge amounts of code that become so hard to maintain that you'll regret the day you started coding them; especially, when you have to port that business logic to a better/newer architecture).
- Keep your controllers thin, your models thinner and your views as clean of PHP and JS code as you can.
- If your application is going to be large, please, do not use the events of your models even though they allow you to do so, make sure they are not being part of a large process. You will end up with a nightmare hard to test, hard to maintain and/or scale. Try to implement the observer pattern differently, allowing your pool of observer objects to be notified about those events. That will make your code easier to test.
- Do not mix different code in your views. Please, please, do not use inline scripts and/or css do not inject javascript code in your PHP files, do not use the dynamic javascript jquery onload capabilities of the framework. I believe this approach is so wrong. Use it for small projects, but do not use it for large ones. Stick with separation of concerns, and keep js where it should be: at the frontend, within JS files... and do us all a favor, do not be a fashionist. Don't end up having your HTML templates in your javascript components, even if the library allows you to do so. K.I.S.S., my friends, K.I.S.S. all the way.
- Use task managers, or module bundlers for your javascript files. We have added a `.bowerrc` and `gulpfile.js` to keep it as simple as possible. Yii Asset Bundlers are good and serve the purpose for small projects, but be honest, is this where the Web design trends are going nowadays?

Yii is a great framework, because of all the tools that it encapsulates. It has great flexibility and even though a lot of people complain about its inheritance madness and internal design, it is still a good robust framework. We just need to be very cautious with that power, as it could bring you more problems than advantages.

Directory Structure
-------------------

[](#directory-structure)

```
app                 [ Yii's application related code: commands, components, controllers, bundles, models, modules,
|                     views and widgets ]
├── assets          [ contains asset's definitions ]
├── commands        [ contains Console commands (Yii names them controllers) ]
├── controllers     [ contains Web controller classes ]
├── migrations      [ database migrations ]
├── models          [ contains model classes ]
├── views           [ contains application views ]
└── widgets         [ contains widget components ]
bin                 [ contains command-line executable scripts ]
bootstrap           [ contains bootstrap process files ]
config              [ contains application configuration files ]
public              [ contains Web application entry script + static resources ]
runtime             [ contains files generated during application's runtime ]
src                 [ contains domain business logic files. Portable code, free of Yii's code. Build your library here. ]
tests               [ contains codeception tests for your application ]

```

Requirements
------------

[](#requirements)

The minimum requirement by this project template that your Web server supports PHP 5.4.0. But we highly recommend you use the latest PHP 7+.

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

[](#installation)

### Install via Composer

[](#install-via-composer)

If you do not have Composer, you may install it by following the instructions at getcomposer.org.

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

```
php composer.phar create-project --prefer-dist --stability=dev 2amigos/yii2-app-template your-site-name

```

Once the commands finish simply do the following:

```
cd your-site-name
composer start-server

```

You will then can access your application on `http://localhost:8080`. To stop the server, simply type on your terminal
`composer stop-server` and it will be stopped. You could also simply `Ctrl+C` to stop the script execution.

Please note, that the composer's commands included on this template have been tested on Linux | Mac environments, no Windows sorry.

Testing
-------

[](#testing)

Tests are located in tests directory. They are developed with Codeception PHP Testing Framework. By default there are 3 test suites:

- unit
- functional
- acceptance

First run the test server. This command will `inject` the `index-test.php` script on your web root so you will be able to run your functional and acceptance tests:

```
composer start-test-server

```

Then tests can be execute by running:

```
composer exec codecept run

```

Or, if you have codeception installed globally simply:

```
codecept run

```

Clean code
----------

[](#clean-code)

We have added some development tools for you to check your work for clean code:

- PHP mess detector: Takes a given PHP source code base and look for several potential problems within that source.
- PHP code sniffer: Tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
- PHP code fixer: Analyzes some PHP source code and tries to fix coding standards issues. Please, modify `.php_cs` to suit your needs.

And you should use them in that order.

### Using php mess detector

[](#using-php-mess-detector)

Sample with all options available:

```
 ./vendor/bin/phpmd ./src text codesize,unusedcode,naming,design,controversial,cleancode
```

### Using code sniffer

[](#using-code-sniffer)

```
 ./vendor/bin/phpcs -s --report=source --standard=PSR2 ./
```

### Using code fixer

[](#using-code-fixer)

We have added a PHP code fixer to standardize our code. It includes Symfony, PSR2 and some contributors rules.

```
./vendor/bin/php-cs-fixer fix ./src --config .php_cs
```

[![2amigOS!](https://camo.githubusercontent.com/cda3de646752adf411381e6bbb880b7e0d4a8a5a42e610d1f5bb513e59e57dff/68747470733a2f2f732e67726176617461722e636f6d2f6176617461722f35353336333339346437323934356666376564333132353536656330343165303f733d3830)](http://www.2amigos.us)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~10 days

Total

9

Last Release

3259d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/566016?v=4)[Antonio Ramirez](/maintainers/tonydspaniard)[@tonydspaniard](https://github.com/tonydspaniard)

---

Top Contributors

[![pana1990](https://avatars.githubusercontent.com/u/6630197?v=4)](https://github.com/pana1990 "pana1990 (12 commits)")[![bahirul](https://avatars.githubusercontent.com/u/8992466?v=4)](https://github.com/bahirul "bahirul (2 commits)")[![flackovic](https://avatars.githubusercontent.com/u/30433073?v=4)](https://github.com/flackovic "flackovic (2 commits)")[![amigo-tabin](https://avatars.githubusercontent.com/u/3017365?v=4)](https://github.com/amigo-tabin "amigo-tabin (1 commits)")[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (1 commits)")

---

Tags

2amigosboilerplatephpproject-templateyii2yii2-application-templateframeworkyii2structureproject templatebasic2amigos

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/2amigos-yii2-app-template/health.svg)

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

###  Alternatives

[yii2mod/base

Base application template for Yii2

531.3k](/packages/yii2mod-base)

PHPackages © 2026

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