PHPackages                             ralphowino/swagger - 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. [API Development](/categories/api)
4. /
5. ralphowino/swagger

ActiveLibrary[API Development](/categories/api)

ralphowino/swagger
==================

01.7kJavaScript

Since Oct 9Pushed 11y ago4 watchersCompare

[ Source](https://github.com/ralphowino/swagger)[ Packagist](https://packagist.org/packages/ralphowino/swagger)[ RSS](/packages/ralphowino-swagger/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

\#Installation ##Via Composer

Edit `composer.json` and to require

```
"ralphowino/swagger" : "dev-master"

```

\##Add providers

Edit `config/app.php` and `"Ralphowino/Swagger/SwaggerServiceProvider"` in providers array

\#Getting Started

\##Initialize your docs To create a new documentation for your api, run:

```
php artisan swagger:init

```

\##Generate Docs from CLI

There are 4 doc types: api, resource, model, operation

\###Api

This doc type allows you to create a standard swagger resource doc type.

To generate one, use command:

```
php artisan swagger:generate api apiname

```

\###Resource

This doc type is a summarised version of the standard swagger resource and includes 2 variables: models and operations.

To generate one, use command:

```
php artisan swagger:generate resource resourcename

```

*You will be requested to specify a list of operations to include*

\###Operation

This doc type represents a single action/route in your api. To generate one, use command:

```
php artisan swagger:generate operation operationName

```

*You will be requested to specify different details about the action such as Verb, Route, etc*

\###Model

This doc type represents a model/custom datatype used in your api. To generate one use command:

```
php artisan swagger:generate model Modelname

```

*You will be asked properties of the model and the required ones*

\##Quick Tutorial

We can create a quick documentation for a to-do list api with simple Crud function for todo items.

\###Initialize

```
php artisan swagger:init

```

*Make sure you have updated your api domain name in config/app.php*

\###Create Models

```
php artisan swagger:generate model Todo --properties="id:integer, title:string, notes:text, completed:boolean, created_at:datetime, updated_at:datetime, completed_at:datetime, deleted_at:datetime" --required="id,title"

php artisan swagger:generate model Item --properties="title:string, notes:text, completed:boolean" --required="title"

```

\###Create Operations

**1. Create Todo**

```
php artisan swagger:generate operation createTodo

```

*General details*

```
verb: POST
path: todos
model: Todo
summary: Create a new todo item
notes:

```

*Parameter: body*

```
parameter: body
parameter.description: create a new todo item
parameter.location: body
parameter.type: iTodo
parameter.required: y
parameter.multiple: n

```

**2.Get Todo**

```
php artisan swagger:generate operation getTodo

```

*General details*

```
verb: GET
path: todos/{id}
model: Todo
summary: Get todo item using its id
notes: Get a todo item using its id. Define fields to retrieve or none if not changed

```

*Parameter: id*

```
parameter: id
parameter.description: id of todo item to retrieve
parameter.location: path
parameter.type: integer
parameter.required: y
parameter.multiple: n

```

*Parameter: if-match-none*

```
parameter: if-match-none
parameter.description: return if etag doesn't match
parameter.location: header
parameter.type: string
parameter.required: n
parameter.multiple: n

```

*Parameter: fields*

```
parameter: fields
parameter.description: fields to return (limited to fields available)
parameter.location: query
parameter.type: string
parameter.required: n
parameter.multiple: n

```

**3.Get Todos**

```
php artisan swagger:generate operation getTodos

```

To populate the operation enter the following answers:

*General details*

```
verb: GET
path: todo
model: array
type: Todo
summary: Get todo items
notes: Get a todo items paginated and filtered based on parameters

```

*Parameter: if-match-none*

```
parameter: if-match-none
parameter.description: return if etag doesn't match
parameter.location: header
parameter.type: string
parameter.required: n
parameter.multiple: n

```

*Parameter: id*

```
parameter: id
parameter.description: filter by ids. Comma separated list allowed
parameter.location: query
parameter.type: string
parameter.required: n
parameter.multiple: n

```

*Parameter: fields*

```
parameter: fields
parameter.description: fields to return (limited to fields available)
parameter.location: query
parameter.type: string
parameter.required: n
parameter.multiple: n

```

*Parameter: page*

```
parameter: page
parameter.description: page to display
parameter.location: query
parameter.type: integer
parameter.required: n
parameter.multiple: n

```

*Parameter: per\_page*

```
parameter: per_page
parameter.description: items to display per page
parameter.location: query
parameter.type: integer
parameter.required: n
parameter.multiple: n

```

**4.Update Todos**

```
php artisan swagger:generate operation updateTodo

```

*General details*

```
verb: PUT
path: todos/{id}
model: Todo
summary: Update a todo item based on ID
notes:

```

*Parameter: body*

```
parameter: body
parameter.description: updated fields
parameter.location: body
parameter.type: iTodo
parameter.required: y
parameter.multiple: n

```

**5.Delete Todo**

```
php artisan swagger:generate operation deleteTodo

```

*General details*

```
verb: DELETE
path: todos/{id}
model:
summary: Delete a todo item based on ID
notes:

```

\###Create Resource

```
php artisan swagger:generate resource todos

operation: gettodos
operation: gettodo
operation: createtodo
operation: updatetodo
operation: deletetodo

```

\#Upcoming features

- Specs within a json doc
- Templates
- Generate from code
- Import Postman doc
- Unit tests

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10953609?v=4)[Ralphowino Consulting](/maintainers/ralphowino)[@ralphowino](https://github.com/ralphowino)

---

Top Contributors

[![rowino](https://avatars.githubusercontent.com/u/2177704?v=4)](https://github.com/rowino "rowino (26 commits)")

### Embed Badge

![Health badge](/badges/ralphowino-swagger/health.svg)

```
[![Health](https://phpackages.com/badges/ralphowino-swagger/health.svg)](https://phpackages.com/packages/ralphowino-swagger)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k14](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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