22 <a href="https://github.com/yiisoft" target="_blank">
33 <img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px" alt="Yii">
44 </a>
5- <h1 align="center">Yii API template</h1>
5+ <h1 align="center">Yii API application</h1>
6+ <h3 align="center">An application template for a new API project</h3>
67 <br>
78</p >
89
1112[ ![ build] ( https://github.com/yiisoft/app-api/actions/workflows/build.yml/badge.svg )] ( https://github.com/yiisoft/app-api/actions/workflows/build.yml )
1213[ ![ Code Coverage] ( https://codecov.io/gh/yiisoft/app-api/branch/master/graph/badge.svg )] ( https://codecov.io/gh/yiisoft/app-api )
1314[ ![ static analysis] ( https://github.com/yiisoft/app-api/workflows/static%20analysis/badge.svg )] ( https://github.com/yiisoft/app-api/actions?query=workflow%3A%22static+analysis%22 )
15+ [ ![ type-coverage] ( https://shepherd.dev/github/yiisoft/app-api/coverage.svg )] ( https://shepherd.dev/github/yiisoft/app-api )
16+ [ ![ psalm-level] ( https://shepherd.dev/github/yiisoft/app-api/level.svg )] ( https://shepherd.dev/github/yiisoft/app-api )
1417
15- API application template for Yii 3.
18+ <p >
19+ <a href="https://github.com/yiisoft/app-api" target="_blank">
20+ <img src="screenshot.png" alt="API request result">
21+ </a>
22+ </p >
23+
24+ The package is an API application template. If you need console only or classic web please start with corresponding
25+ templates:
26+
27+ - [ Console application template] ( https://github.com/yiisoft/app-console )
28+ - [ Web application template] ( https://github.com/yiisoft/app )
1629
1730## Requirements
1831
1932- PHP 8.2 or higher.
2033
21- ## Local installation
34+ ## Installation
35+
36+ ### Local installation
2237
2338If you do not have [ Composer] ( https://getcomposer.org/ ) , you may install it by following the instructions
2439at [ getcomposer.org] ( https://getcomposer.org/doc/00-intro.md ) .
2540
2641Create a project:
2742
2843``` shell
29- composer create-project yiisoft/app-api --stability=dev myproject
44+ composer create-project yiisoft/app-api myproject
3045cd myproject
3146```
3247
@@ -37,11 +52,12 @@ APP_ENV=dev ./yii serve
3752```
3853
3954Now you should be able to access the application through the URL printed to console.
40- Usually it is ` https ://127.0.0.1 :8080` .
55+ Usually it is ` http ://localhost :8080` .
4156
42- Authorization is performed via the ` X-Api-Key ` header.
57+ ### Installation with Docker
4358
44- ## Installation with Docker
59+ > [ !WARNING]
60+ > Docker compose version 2.24 or above is required.
4561
4662Fork the repository, clone it, then:
4763
@@ -63,37 +79,58 @@ make down
6379```
6480
6581The application is available at ` https://localhost ` .
66- Authorization is performed via the ` X-Api-Key ` header.
6782
68- ## API Documentation
83+ Other make commands are available in the ` Makefile ` and can be listed with:
6984
70- API documentation is available at ` /docs ` . It is built from OpenAPI annotations (` @OA ` ).
85+ ``` shell
86+ make help
87+ ```
7188
72- See [ Swagger-PHP documentation] ( https://zircote.github.io/swagger-php/guide/annotations.html ) for details
73- on how to annotate your code.
89+ ## Directory structure
7490
75- ## Getting help
91+ The application template has the following structure:
7692
77- If you need help or have a question, the [ Yii Forum] ( https://forum.yiiframework.com/c/yii-3-0/63 ) is a good place for that.
78- You may also check out other [ Yii Community Resources] ( https://www.yiiframework.com/community ) .
93+ ```
94+ config/ Configuration files.
95+ common/ Common configuration and DI definitions.
96+ console/ Console-specific configuration.
97+ environments/ Environment-specific configuration (dev/test/prod).
98+ web/ Web-specific configuration.
99+ docker/ Docker-specific files.
100+ public/ Files publically accessible from the Internet.
101+ index.php Entry script.
102+ runtime/ Files generated during runtime.
103+ src/ Application source code.
104+ Api/ API action handlers and API-specific code.
105+ Shared/ Shared API components (middleware, presenters, factories).
106+ Console/ Console commands.
107+ Shared/ Code shared between API and console applications.
108+ tests/ A set of Codeception tests for the application.
109+ Api/ API endpoints tests.
110+ Console/ Console command tests.
111+ Functional/ Functional tests.
112+ Unit/ Unit tests.
113+ vendor/ Installed Composer packages.
114+ Makefile Config for make command.
115+ yii Console application entry point.
116+ ```
79117
80- ## Codeception testing
118+ ## Testing
81119
82120The template comes with ready to use [ Codeception] ( https://codeception.com/ ) configuration.
83121To execute tests, in local installation run:
84122
85123``` shell
86124./vendor/bin/codecept build
87125
88- ./yii serve > ./runtime/yii.log 2>&1 &
126+ APP_ENV=test ./yii serve > ./runtime/yii.log 2>&1 &
89127./vendor/bin/codecept run
90128```
91129
92130For Docker:
93131
94132``` shell
95133make codecept build
96-
97134make codecept run
98135```
99136
@@ -111,9 +148,13 @@ or, using Docker:
111148make psalm
112149```
113150
151+ ## Support
152+
153+ If you need help or have a question, check out [ Yii Community Resources] ( https://www.yiiframework.com/community ) .
154+
114155## License
115156
116- The Yii API template is free software. It is released under the terms of the BSD License.
157+ The Yii3 API template is free software. It is released under the terms of the BSD License.
117158Please see [ ` LICENSE ` ] ( ./LICENSE.md ) for more information.
118159
119160Maintained by [ Yii Software] ( https://www.yiiframework.com/ ) .
@@ -128,4 +169,4 @@ Maintained by [Yii Software](https://www.yiiframework.com/).
128169[ ![ Twitter] ( https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555?style=flat )] ( https://twitter.com/yiiframework )
129170[ ![ Telegram] ( https://img.shields.io/badge/telegram-join-1DA1F2?style=flat&logo=telegram )] ( https://t.me/yii3en )
130171[ ![ Facebook] ( https://img.shields.io/badge/facebook-join-1DA1F2?style=flat&logo=facebook&logoColor=ffffff )] ( https://www.facebook.com/groups/yiitalk )
131- [ ![ Slack] ( https://img.shields.io/badge/slack-join-1DA1F2?style=flat&logo=slack )] ( https://www. yiiframework.com/go/slack )
172+ [ ![ Slack] ( https://img.shields.io/badge/slack-join-1DA1F2?style=flat&logo=slack )] ( https://yiiframework.com/go/slack )
0 commit comments