yiisoft/app

Yii3 web application template

Fund package maintenance!
Opencollective
yiisoft

Installs: 7 477

Dependents: 0

Suggesters: 0

Security: 0

Stars: 255

Watchers: 31

Forks: 52

Open Issues: 5

Type:project


README

Yii

Yii3 web application

An application template for a new web project


Latest Stable Version Total Downloads Build status Code Coverage static analysis type-coverage

Home page

The package is a classic web application template. If you need console only or API please start with corresponding templates:

Requirements

  • PHP 8.2 or higher.

Installation

Local installation

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

Create a project:

composer create-project yiisoft/app myproject
cd myproject

To run the app:

APP_ENV=dev ./yii serve

Now you should be able to access the application through the URL printed to console. Usually it is http://localhost:8080.

Installation with Docker

Fork the repository, clone it, then:

cd myproject
make composer update

To run the app:

make up

To stop the app:

make down

The application is available at https://localhost.

Other make commands are available in the Makefile and can be listed with:

make help

Directory structure

The application template has the following structure:

assets/                     Asset bundle source files.
config/                     Configuration files.
    common/                 Common configuration and DI definitions.
    console/                Console-specific configuration.
    environments/           Environment-specific configuration (dev/test/prod).
    web/                    Web-specific configuration.
docker/                     Docker-specific files.
docs/                       Documentation.
public/                     Files publically accessible from the Internet.
    assets/                 Published/compiled assets.
    index.php               Entry script.
runtime/                    Files generated during runtime.
src/                        Application source code.
    Command/                Console commands.
    Controller/             Web controller classes with templates.
    Handler/                Request handlers (e.g., NotFound).
    Layout/                 Layout components and templates.
    ApplicationParams.php   Application parameters class.
    Environment.php         Environment configuration class.
tests/                      A set of Codeception tests for the application.
    Console/                Console command tests.
    Functional/             Functional tests.
    Unit/                   Unit tests.
    Web/                    Web interface tests.
vendor/                     Installed Composer packages.
Makefile                    Config for make command.
yii                         Console application entry point.

Testing

The template comes with ready to use Codeception configuration. To execute tests, in local installation run:

./vendor/bin/codecept build

APP_ENV=test ./yii serve > ./runtime/yii.log 2>&1 &
./vendor/bin/codecept run

For Docker:

make codecept build
make codecept run

Static analysis

The code is statically analyzed with Psalm. To run static analysis:

./vendor/bin/psalm

or, using Docker:

make psalm

Support

If you need help or have a question, check out Yii Community Resources.

License

The Yii3 web application template is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.

Maintained by Yii Software.

Support the project

Open Collective

Follow updates

Official website Twitter Telegram Facebook Slack