PHPackages                             farit-slv/yii2-oas3 - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. farit-slv/yii2-oas3

ActiveYii2-extension[HTTP &amp; Networking](/categories/http)

farit-slv/yii2-oas3
===================

Yii2 Open Api Swagger 3 integration

v0.4(2y ago)0175MITPHPPHP &gt;=7.4

Since Jul 4Pushed 2y agoCompare

[ Source](https://github.com/FaritSlv/yii2-oas3)[ Packagist](https://packagist.org/packages/farit-slv/yii2-oas3)[ RSS](/packages/farit-slv-yii2-oas3/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

Open Api Swagger 3 for Yii2 Framework
=====================================

[](#open-api-swagger-3-for-yii2-framework)

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

[](#requirements)

- PHP 7.4
- Yii2 Framework

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

[](#installation)

The preferred way to install this wrapper is through [composer](http://getcomposer.org/download/).

```
php composer.phar require farit-slv/yii2-oas3 "*"
```

or

```
composer require farit-slv/yii2-oas3 "*"
```

or add to the require section of `composer.json`

```
"farit-slv/yii2-oas3" : "*"

```

Integration
-----------

[](#integration)

Add action to web controller (for example SiteController.php):

```
public function actions()
{
    return [
        'api-redoc' => [
            'class' => 'farit-slv\swagger\ViewAction',
            'apiJsonUrl' => \yii\helpers\Url::to(['/site/api-json'], true),
            'useReDoc' => true,
        ],
        'api-docs' => [
            'class' => 'farit-slv\swagger\ViewAction',
            'apiJsonUrl' => \yii\helpers\Url::to(['/site/api-json'], true),
        ],
        'api-json' => [
            'class' => 'farit-slv\swagger\JsonAction',
            'dirs' => [
                Yii::getAlias('@api/modules/api/controllers'),
                Yii::getAlias('@api/modules/api/models'),
                Yii::getAlias('@api/models'),
            ],
        ],
    ];
}
```

Open Api Swagger 3 example annotation
-------------------------------------

[](#open-api-swagger-3-example-annotation)

Api server description

```
/**
 * @OA\Info(
 *   version="1.0",
 *   title="Application API",
 *   description="Server - Mobile app API",
 *   @OA\Contact(
 *     name="John Smith",
 *     email="john@example.com",
 *   ),
 * ),
 * @OA\Server(
 *   url="https://example.com/api",
 *   description="main server",
 * )
 * @OA\Server(
 *   url="https://dev.example.com/api",
 *   description="dev server",
 * )
 */

class DefaultController extends Controller
{
...
```

Controller annotation

```
/**
 * @OA\Get(path="/",
 *   summary="Handshake",
 *   tags={"handshake"},
 *   @OA\Parameter(
 *     name="access-token",
 *     in="header",
 *     required=false,
 *     @OA\Schema(
 *       type="string"
 *     )
 *   ),
 *   @OA\Response(
 *     response=200,
 *     description="Returns Hello object",
 *     @OA\MediaType(
 *         mediaType="application/json",
 *         @OA\Schema(ref="#/components/schemas/Hello"),
 *     ),
 *   ),
 * )
 */
public function actionIndex()
{
...
```

Model annotation

```
/**
 *@OA\Schema(
 *  schema="Hello",
 *  @OA\Property(
 *     property="message",
 *     type="string",
 *     description="Text message"
 *  ),
 *  @OA\Property(
 *     property="time",
 *     type="integer",
 *     description="Server current Unix time"
 *  ),
 *  @OA\Property(
 *     property="date",
 *     type="string",
 *     format="date-time",
 *     description="Server current date time"
 *  )
 *)
 */
class Hello extends Model
{
...
```

Donate
------

[](#donate)

[![](https://camo.githubusercontent.com/f72973a690601ae9170128b07e34a821c2010aac81e1d0e2104e23cbb171e7e0/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f55532f52552f692f62746e2f62746e5f646f6e61746543435f4c472e676966)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2PURUX2SHUD9E)

LICENSE
-------

[](#license)

This curl wrapper is released under the [MIT license](https://github.com/walkor/workerman/blob/master/MIT-LICENSE.txt).

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

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

Total

2

Last Release

1035d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/69817b83d44336101a05c78d064b8dbaa2c81c268799224620bcd7883a364d6c?d=identicon)[Farit](/maintainers/Farit)

---

Top Contributors

[![FaritSlv](https://avatars.githubusercontent.com/u/7736725?v=4)](https://github.com/FaritSlv "FaritSlv (8 commits)")[![WebmasterBisonTransport](https://avatars.githubusercontent.com/u/38669936?v=4)](https://github.com/WebmasterBisonTransport "WebmasterBisonTransport (8 commits)")[![genxoft](https://avatars.githubusercontent.com/u/26364719?v=4)](https://github.com/genxoft "genxoft (6 commits)")[![albertborsos](https://avatars.githubusercontent.com/u/7307145?v=4)](https://github.com/albertborsos "albertborsos (1 commits)")

---

Tags

jsonrestswaggeryii2restfullopen-api

### Embed Badge

![Health badge](/badges/farit-slv-yii2-oas3/health.svg)

```
[![Health](https://phpackages.com/badges/farit-slv-yii2-oas3/health.svg)](https://phpackages.com/packages/farit-slv-yii2-oas3)
```

###  Alternatives

[genxoft/yii2-oas3

Yii2 Open Api Swagger 3 integration

18346.3k1](/packages/genxoft-yii2-oas3)[tuyakhov/yii2-json-api

Implementation of JSON API specification for the Yii framework

140115.6k](/packages/tuyakhov-yii2-json-api)[api-platform/json-schema

Generate a JSON Schema from a PHP class

273.4M26](/packages/api-platform-json-schema)[tunecino/yii2-nested-rest

Adds nested resources routing support along with related actions and relationship handlers to the Yii RESTful API framework

4815.8k](/packages/tunecino-yii2-nested-rest)[simialbi/yii2-rest-client

REST client (AR-like model) for Yii Framework 2.0 (via yii2-http-client, extends ApexWire/yii2-restclient)

2232.5k](/packages/simialbi-yii2-rest-client)

PHPackages © 2026

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