PHPackages                             cebe/yii2-openapi - 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. cebe/yii2-openapi

Abandoned → [php-openapi/yii2-openapi](/?search=php-openapi%2Fyii2-openapi)ArchivedLibrary[HTTP &amp; Networking](/categories/http)

cebe/yii2-openapi
=================

Generate full REST API application from OpenAPI 3 specification.

1.0.2(6y ago)13019.5k23[24 issues](https://github.com/cebe/yii2-openapi/issues)MITPHPPHP &gt;=7.1.0

Since Mar 22Pushed 1y ago8 watchersCompare

[ Source](https://github.com/cebe/yii2-openapi)[ Packagist](https://packagist.org/packages/cebe/yii2-openapi)[ Docs](https://github.com/cebe/yii2-openapi#readme)[ RSS](/packages/cebe-yii2-openapi/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (8)Versions (11)Used By (0)

yii2-openapi
============

[](#yii2-openapi)

> **This repository has been moved to .**
> **Please use the new package `php-openapi/yii2-openapi` instead.**

REST API application generator for Yii2, openapi 3.0 YAML -&gt; Yii2.

Base on [Gii, the Yii Framework Code Generator](https://www.yiiframework.com/extension/yiisoft/yii2-gii).

[![Latest Stable Version](https://camo.githubusercontent.com/b824a0aff742f8974404ed0bf27f7ff1ece79a2bc7abb7a3103a6e978856aa19/68747470733a2f2f706f7365722e707567782e6f72672f636562652f796969322d6f70656e6170692f762f737461626c65)](https://packagist.org/packages/cebe/yii2-openapi)[![Latest Alpha Version](https://camo.githubusercontent.com/604d39d7ca4f1c04b99f208be910144119e5fef05eee89e1da7b1fa3e6113a61/68747470733a2f2f706f7365722e707567782e6f72672f636562652f796969322d6f70656e6170692f762f756e737461626c65)](https://packagist.org/packages/cebe/yii2-openapi)[![Total Downloads](https://camo.githubusercontent.com/caedf1e3caef7f66f110ff7d5c80f63676a889974878476a71e42c4846eedda3/68747470733a2f2f706f7365722e707567782e6f72672f636562652f796969322d6f70656e6170692f646f776e6c6f616473)](https://packagist.org/packages/cebe/yii2-openapi)[![License](https://camo.githubusercontent.com/2c29f7b0d1909523129b4f0e6e5567b330508a68ad9924d8ac223a8a283fce37/68747470733a2f2f706f7365722e707567782e6f72672f636562652f796969322d6f70656e6170692f6c6963656e7365)](https://packagist.org/packages/cebe/yii2-openapi)[![yii2-openapi](https://github.com/cebe/yii2-openapi/workflows/yii2-openapi/badge.svg?branch=wip)](https://github.com/cebe/yii2-openapi/workflows/yii2-openapi/badge.svg?branch=wip)

TLDR; what is this?
-------------------

[](#tldr-what-is-this)

A code generator for OpenAPI and Yii Framework based PHP API application.

Input: [OpenAPI 3.0 YAML or JSON](https://github.com/OAI/OpenAPI-Specification#the-openapi-specification) (via [cebe/php-openapi](https://github.com/cebe/php-openapi))

Output: Yii Framework Application with Controllers, Models, database schema

Features
--------

[](#features)

Currently available features:

- Generate Path mappings, **Controllers** and Actions **for API Endpoints**. CRUD Endpoints are ready-to-use, other Endpoints are generated as abstract functions that need to be implemented
- Generate **Models** and validation based on OpenAPI Schema
- Generate **Database Schema** from OpenAPI Schema
- Generates **Database Migrations** for schema changes
- Provide **Dummy Data** via Faker for development

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

[](#requirements)

- PHP 7.1 or higher (works fine with PHP 8)

Install
-------

[](#install)

```
composer require php-openapi/yii2-openapi:^2.0@beta

```

Usage
-----

[](#usage)

You can use this package in your existing application or start a new project using the [yii2-app-api](https://github.com/cebe/yii2-app-api) application template. For usage of the template, see instructions in the template repo readme.

In your existing Yii application config (works for console as well as web):

```
