PHPackages                             kelvinwongg/yapi - 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. kelvinwongg/yapi

ActiveFramework[Framework](/categories/framework)

kelvinwongg/yapi
================

A single declarative yaml document crud api cms framwork, or whatever

v0.1.1-beta.2(3y ago)18GPL-3.0-onlyPHP

Since Jan 9Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/kelvinwongg/yapi)[ Packagist](https://packagist.org/packages/kelvinwongg/yapi)[ RSS](/packages/kelvinwongg-yapi/feed)WikiDiscussions main Synced today

READMEChangelog (3)DependenciesVersions (4)Used By (0)

YAPI
====

[](#yapi)

A zero-configuration, single declarative YAML document, HTTP CRUD API framwork.

Installation
============

[](#installation)

Install YAPI in your project root via `composer`

```
composer require kelvinwongg/yapi
```

Usage
=====

[](#usage)

`/api.yaml`

```
openapi: 3.0.0

info:
  version: 1.0.0
  title: 'HR API'

paths:
  /employees:
    get:
      description: 'Obtain information about all employees from the HR database'
      parameters:
        - name: bodyLimit
          in: query
          required: true
          description: The amount of employees returned
          schema:
            type: integer
            minimum: 10
            maximum: 20
            example: 15
        - name: pageLimit
          in: query
          # required: true
          description: The pages to return employees info
          schema:
            type: integer
            minimum: 1
            maximum: 5
            example: 2
      responses:
        200:
          description: Successful pull of employee info
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Employees'

components:
  schemas:
    Employees:
      description: 'Array of employee info'
      type: array
      items:
        $ref: '#/components/schemas/Employee'
    Employee:
      description: 'Model containing employee info'
      type: object
      properties:
        id:
          type: integer
          example: 4
        employee_name:
          type: string
          example: Ryan Pinkham
        employee_title:
          type: string
          example: Market Manager
```

`/index.php`

```
require_once __DIR__ . '/vendor/autoload.php';
$yapi = new \Yapi\Yapi('./api.yaml');
```

`/paths/Employees.php`

```
