PHPackages                             yiisoft/app-api - 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. yiisoft/app-api

ActiveProject[Framework](/categories/framework)

yiisoft/app-api
===============

Yii3 API project template

1.2.0(1w ago)971.5k—0%31[1 PRs](https://github.com/yiisoft/app-api/pulls)BSD-3-ClausePHPPHP 8.2 - 8.5CI passing

Since Jul 31Pushed yesterday15 watchersCompare

[ Source](https://github.com/yiisoft/app-api)[ Packagist](https://packagist.org/packages/yiisoft/app-api)[ Docs](https://github.com/yiisoft/app-api/)[ GitHub Sponsors](https://github.com/sponsors/yiisoft)[ OpenCollective](https://opencollective.com/yiisoft)[ RSS](/packages/yiisoft-app-api/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (45)Versions (10)Used By (0)

 [ ![Yii](https://camo.githubusercontent.com/8317c17418b39410a660f5149071d26c5023c0d5fb2b7ebb771324812f666d73/68747470733a2f2f796969736f66742e6769746875622e696f2f646f63732f696d616765732f7969695f6c6f676f2e737667) ](https://github.com/yiisoft)

Yii API application
===================

[](#yii-api-application)

### An application template for a new API project

[](#an-application-template-for-a-new-api-project)

[![Latest Stable Version](https://camo.githubusercontent.com/24dd4401c9bfef63807420d5ba82547f6323d29107bbff78415de8766568e433/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f6170702d6170692f76)](https://packagist.org/packages/yiisoft/app-api)[![Total Downloads](https://camo.githubusercontent.com/e59036584c1f1d5ce6aa5c95ac6052e9cc8e6d014f322114b7d3a5c8314358f4/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f6170702d6170692f646f776e6c6f616473)](https://packagist.org/packages/yiisoft/app-api)[![build](https://github.com/yiisoft/app-api/actions/workflows/build.yml/badge.svg)](https://github.com/yiisoft/app-api/actions/workflows/build.yml)[![Code Coverage](https://camo.githubusercontent.com/66f407e4cd889113bbab37453f96c6e6f1856a1622bcb6610b3a8e157580f351/68747470733a2f2f636f6465636f762e696f2f67682f796969736f66742f6170702d6170692f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/yiisoft/app-api)[![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)[![type-coverage](https://camo.githubusercontent.com/7c8ebfc7b0fc2008f5b1c30b30e6716d9f58bfe53e5f2e332bf1362228d5c55a/68747470733a2f2f73686570686572642e6465762f6769746875622f796969736f66742f6170702d6170692f636f7665726167652e737667)](https://shepherd.dev/github/yiisoft/app-api)[![psalm-level](https://camo.githubusercontent.com/81b4e637f4edb69f1b17f313871e532ea1ea70ced3b2d379af1d543d3db63349/68747470733a2f2f73686570686572642e6465762f6769746875622f796969736f66742f6170702d6170692f6c6576656c2e737667)](https://shepherd.dev/github/yiisoft/app-api)

 [ ![API request result](screenshot.png) ](https://github.com/yiisoft/app-api)

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

- [Console application template](https://github.com/yiisoft/app-console)
- [Web application template](https://github.com/yiisoft/app)

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

[](#requirements)

- PHP 8.2 - 8.5.

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

[](#installation)

### Local installation

[](#local-installation)

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

Create a project:

```
composer create-project yiisoft/app-api 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

[](#installation-with-docker)

Warning

Docker compose version 2.24 or above is required.

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
-------------------

[](#directory-structure)

The 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.

```

Testing
-------

[](#testing)

The template comes with ready to use [Codeception](https://codeception.com/) 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
---------------

[](#static-analysis)

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:

```
./vendor/bin/psalm
```

or, using Docker:

```
make psalm
```

Support
-------

[](#support)

If you need help or have a question, check out [Yii Community Resources](https://www.yiiframework.com/community).

License
-------

[](#license)

The Yii3 API template is free software. It is released under the terms of the BSD License. Please see [`LICENSE`](./LICENSE.md) for more information.

Maintained by [Yii Software](https://www.yiiframework.com/).

Support the project
-------------------

[](#support-the-project)

[![Open Collective](https://camo.githubusercontent.com/a2b15f8e2268d4e3842e00d41ff7a57cce2ad8bd8d8769c5dc4fa05a546a4f62/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4f70656e253230436f6c6c6563746976652d73706f6e736f722d3765616466313f6c6f676f3d6f70656e253230636f6c6c656374697665266c6f676f436f6c6f723d376561646631266c6162656c436f6c6f723d353535353535)](https://opencollective.com/yiisoft)

Follow updates
--------------

[](#follow-updates)

[![Official website](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)](https://www.yiiframework.com/)[![Twitter](https://camo.githubusercontent.com/d077c362ac639792171af8bc002ee827816733dfc0925f70b557e6d151022226/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f747769747465722d666f6c6c6f772d3144413146323f6c6f676f3d74776974746572266c6f676f436f6c6f723d314441314632266c6162656c436f6c6f723d3535353535353f7374796c653d666c6174)](https://twitter.com/yiiframework)[![Telegram](https://camo.githubusercontent.com/4e38dd12535575c39c65bea7119b95e663abb2d1f4e3d669a27bbda07ef603f0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74656c656772616d2d6a6f696e2d3144413146323f7374796c653d666c6174266c6f676f3d74656c656772616d)](https://t.me/yii3en)[![Facebook](https://camo.githubusercontent.com/48204e301b34b29b0815854544f04c337fc0692096cab35e9a1f8c53a42c2307/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f66616365626f6f6b2d6a6f696e2d3144413146323f7374796c653d666c6174266c6f676f3d66616365626f6f6b266c6f676f436f6c6f723d666666666666)](https://www.facebook.com/groups/yiitalk)[![Slack](https://camo.githubusercontent.com/1a3645ba1c97e6684d0349bc478201e1621ba0d3efad516d81035364d442bad7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736c61636b2d6a6f696e2d3144413146323f7374796c653d666c6174266c6f676f3d736c61636b)](https://yiiframework.com/go/slack)

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance99

Actively maintained with recent releases

Popularity37

Limited adoption so far

Community32

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~78 days

Total

3

Last Release

13d ago

PHP version history (2 changes)1.0.0PHP ^8.2

1.1.0PHP 8.2 - 8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/261a6249c6f605f3956a2fae40fbb813f6b2e1e6f2bf806180c851a965426e54?d=identicon)[cebe](/maintainers/cebe)

![](https://www.gravatar.com/avatar/fc29e4e7068a00fe9b9db37b8aadda1db6020adcacef810461e47b99c2b150e6?d=identicon)[samdark](/maintainers/samdark)

![](https://www.gravatar.com/avatar/ccb75e3312d6bd454ea445ea308139fd185a4ca906ca5df21cc66e6a35de25a3?d=identicon)[SilverFire](/maintainers/SilverFire)

![](https://www.gravatar.com/avatar/99106256c24a8cb23871b99fa90e48f37f1aa71608c185759b7d2a88683a5918?d=identicon)[hiqsol](/maintainers/hiqsol)

---

Top Contributors

[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (84 commits)")[![vjik](https://avatars.githubusercontent.com/u/525501?v=4)](https://github.com/vjik "vjik (60 commits)")[![devanych](https://avatars.githubusercontent.com/u/20116244?v=4)](https://github.com/devanych "devanych (33 commits)")[![xepozz](https://avatars.githubusercontent.com/u/6815714?v=4)](https://github.com/xepozz "xepozz (24 commits)")[![rustamwin](https://avatars.githubusercontent.com/u/16498265?v=4)](https://github.com/rustamwin "rustamwin (21 commits)")[![romkatsu](https://avatars.githubusercontent.com/u/1677515?v=4)](https://github.com/romkatsu "romkatsu (13 commits)")[![terabytesoftw](https://avatars.githubusercontent.com/u/42547589?v=4)](https://github.com/terabytesoftw "terabytesoftw (7 commits)")[![yiiliveext](https://avatars.githubusercontent.com/u/37578608?v=4)](https://github.com/yiiliveext "yiiliveext (5 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (5 commits)")[![roxblnfk](https://avatars.githubusercontent.com/u/4152481?v=4)](https://github.com/roxblnfk "roxblnfk (3 commits)")[![luizcmarin](https://avatars.githubusercontent.com/u/67489841?v=4)](https://github.com/luizcmarin "luizcmarin (3 commits)")[![nkondrashov](https://avatars.githubusercontent.com/u/10756741?v=4)](https://github.com/nkondrashov "nkondrashov (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![Fantom409](https://avatars.githubusercontent.com/u/14968877?v=4)](https://github.com/Fantom409 "Fantom409 (2 commits)")[![random-rage](https://avatars.githubusercontent.com/u/9934893?v=4)](https://github.com/random-rage "random-rage (1 commits)")[![aa-chernyh](https://avatars.githubusercontent.com/u/18482125?v=4)](https://github.com/aa-chernyh "aa-chernyh (1 commits)")[![Nex-Otaku](https://avatars.githubusercontent.com/u/2260071?v=4)](https://github.com/Nex-Otaku "Nex-Otaku (1 commits)")[![Mister-42](https://avatars.githubusercontent.com/u/68641750?v=4)](https://github.com/Mister-42 "Mister-42 (1 commits)")[![s1lver](https://avatars.githubusercontent.com/u/4567634?v=4)](https://github.com/s1lver "s1lver (1 commits)")[![klunker](https://avatars.githubusercontent.com/u/741381?v=4)](https://github.com/klunker "klunker (1 commits)")

---

Tags

apihacktoberfestrestyii3apirestappyii3

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yiisoft-app-api/health.svg)

```
[![Health](https://phpackages.com/badges/yiisoft-app-api/health.svg)](https://phpackages.com/packages/yiisoft-app-api)
```

###  Alternatives

[yiisoft/app

Yii3 web application template

35011.3k](/packages/yiisoft-app)[slim/slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

12.2k49.0M1.1k](/packages/slim-slim)[yiisoft/yii-runner-roadrunner

Web application runner for RoadRunner

3410.0k](/packages/yiisoft-yii-runner-roadrunner)[yiisoft/input-http

Maps data from PSR-7 HTTP request to PHP DTO representing user input.

1170.3k7](/packages/yiisoft-input-http)[yiisoft/yii-middleware

Yii Middleware

21148.4k1](/packages/yiisoft-yii-middleware)[yiisoft/error-handler

Yii Error Handling Library

21353.9k12](/packages/yiisoft-error-handler)

PHPackages © 2026

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