The package is an API application template. If you need console only or classic web please start with corresponding templates:
- PHP 8.2 or higher.
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-api myproject
cd myprojectTo run the app:
APP_ENV=dev ./yii serveNow you should be able to access the application through the URL printed to console.
Usually it is http://localhost:8080.
Warning
Docker compose version 2.24 or above is required.
Fork the repository, clone it, then:
cd myproject
make composer updateTo run the app:
make upTo stop the app:
make downThe application is available at https://localhost.
Other make commands are available in the Makefile and can be listed with:
make helpThe application template has the following structure:
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.
public/ Files publically accessible from the Internet.
index.php Entry script.
runtime/ Files generated during runtime.
src/ Application source code.
Api/ API action handlers and API-specific code.
Shared/ Shared API components (middleware, presenters, factories).
Console/ Console commands.
Shared/ Code shared between API and console applications.
tests/ A set of Codeception tests for the application.
Api/ API endpoints tests.
Console/ Console command tests.
Functional/ Functional tests.
Unit/ Unit tests.
vendor/ Installed Composer packages.
Makefile Config for make command.
yii Console application entry point.
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 runFor Docker:
make codecept build
make codecept runThe code is statically analyzed with Psalm. To run static analysis:
./vendor/bin/psalmor, using Docker:
make psalmIf you need help or have a question, check out Yii Community Resources.
The Yii3 API template is free software. It is released under the terms of the BSD License.
Please see LICENSE for more information.
Maintained by Yii Software.