All Projects → cebe → Yii2 Openapi

cebe / Yii2 Openapi

Licence: mit
REST API application generator for Yii2, openapi 3.0 YAML -> Yii2

Projects that are alternatives of or similar to Yii2 Openapi

Openapi Generator
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
Stars: ✭ 10,634 (+10641.41%)
Mutual labels:  rest-api, openapi3, hacktoberfest
Yii2 Redis
Yii 2 Redis extension.
Stars: ✭ 416 (+320.2%)
Mutual labels:  hacktoberfest, yii2, yii
Yii2 Mongodb
Yii 2 MongoDB extension
Stars: ✭ 299 (+202.02%)
Mutual labels:  hacktoberfest, yii2, yii
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+3382.83%)
Mutual labels:  rest-api, openapi3, hacktoberfest
Luya
LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.
Stars: ✭ 741 (+648.48%)
Mutual labels:  rest-api, hacktoberfest, yii2
Yii2 Imagine
Yii 2 imagine extension
Stars: ✭ 271 (+173.74%)
Mutual labels:  hacktoberfest, yii2, yii
Yii2 Httpclient
Yii 2 HTTP client
Stars: ✭ 406 (+310.1%)
Mutual labels:  hacktoberfest, yii2, yii
Yii2 Bootstrap4
Yii 2 Bootstrap 4 Extension
Stars: ✭ 204 (+106.06%)
Mutual labels:  hacktoberfest, yii2, yii
Yii2 App Basic
Yii 2.0 Basic Application Template
Stars: ✭ 548 (+453.54%)
Mutual labels:  hacktoberfest, yii2, yii
Swagger Ui
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
Stars: ✭ 21,279 (+21393.94%)
Mutual labels:  rest-api, openapi3, hacktoberfest
Swagger Js
Javascript library to connect to swagger-enabled APIs via browser or nodejs
Stars: ✭ 2,319 (+2242.42%)
Mutual labels:  rest-api, openapi3, hacktoberfest
Swagger Editor
Swagger Editor
Stars: ✭ 7,365 (+7339.39%)
Mutual labels:  rest-api, openapi3, hacktoberfest
Yii2 Apidoc
Yii 2 apidoc extension.
Stars: ✭ 236 (+138.38%)
Mutual labels:  hacktoberfest, yii2, yii
Yii2 Docker
Official Docker images suitable for Yii 2.0
Stars: ✭ 286 (+188.89%)
Mutual labels:  hacktoberfest, yii2, yii
Yii2
Yii 2: The Fast, Secure and Professional PHP Framework
Stars: ✭ 13,852 (+13891.92%)
Mutual labels:  hacktoberfest, yii2, yii
Yii2 Elasticsearch
Yii 2 Elasticsearch extension
Stars: ✭ 401 (+305.05%)
Mutual labels:  hacktoberfest, yii2, yii
Yii2 Debug
Debug Extension for Yii 2
Stars: ✭ 179 (+80.81%)
Mutual labels:  hacktoberfest, yii2, yii
Yii2 Gii
Yii 2 Gii Extension
Stars: ✭ 183 (+84.85%)
Mutual labels:  hacktoberfest, yii2, yii
Express Openapi Validator
🦋 Auto-validates api requests, responses, and securities using ExpressJS and an OpenAPI 3.x specification
Stars: ✭ 436 (+340.4%)
Mutual labels:  rest-api, openapi3, hacktoberfest
Apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..
Stars: ✭ 831 (+739.39%)
Mutual labels:  rest-api, openapi3, hacktoberfest

yii2-openapi

REST API application generator for Yii2, openapi 3.0 YAML -> Yii2.

Base on Gii, the Yii Framework Code Generator.

Latest Stable Version Total Downloads License Build Status

what should this do?

Input: OpenAPI 3.0 YAML or JSON (via cebe/php-openapi)

Output: Controllers, Models, database schema

Features

This library is currently work in progress, current features are checked here when ready:

  • [x] generate Controllers + Actions

  • [x] generate Models

  • [x] generate Database migration

  • [x] provide Dummy API via Faker

  • [x] update Database and models when API schema changes

Requirements

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

Install

composer require cebe/yii2-openapi:@beta cebe/php-openapi:@beta

Usage

You can use this package in your existing application or start a new project using the 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):

<?php
$config = [
    // ... this is your application config ...
];

if (YII_ENV_DEV) {
    // enable Gii module
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => yii\gii\Module::class,
        'generators' => [
            // add ApiGenerator to Gii module
            'api' => \cebe\yii2openapi\generator\ApiGenerator::class,
        ],
    ];
}

return $config;

To use the web generator, open index.php?r=gii and select the REST API Generator.

On console you can run the generator with ./yii gii/api [email protected]/openapi.yaml. Where @app/openapi.yaml should be the absolute path to your OpenAPI spec file. This can be JSON as well as YAML (see also cebe/php-openapi for supported formats).

Run ./yii gii/api --help for all options.

OpenAPI extensions

This library understands the following extensions to the OpenAPI spec:

x-faker

You may specify custom PHP code for generating fake data for a property:

    Post:
      properties:
        id:
          type: integer
        tags:
          type: array
          items:
            type: string
          example: ['one', 'two']
          x-faker: "$faker->randomElements(['one', 'two', 'three', 'four'])"

Screenshots

Gii Generator Form:

Gii Generator Form

Generated files:

Gii Generated Files

Support

Need help with your API project?

Professional support, consulting as well as software development services are available:

https://www.cebe.cc/en/contact

Development of this library is sponsored by cebe.☁️ "Your Professional Deployment Platform".

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].