PHPackages                             iomanager/swgenerator - 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. iomanager/swgenerator

ActiveLibrary[API Development](/categories/api)

iomanager/swgenerator
=====================

Generate Json file for Swagger OpenApi Documentation

07PHP

Since Mar 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ignades/IoManager)[ Packagist](https://packagist.org/packages/iomanager/swgenerator)[ RSS](/packages/iomanager-swgenerator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Install package in Laravel
--------------------------

[](#install-package-in-laravel)

```
composer require iomanager/swgenerator:dev-main

```

About LaravelOpenApiManager Author:Ignacio Sebastian Olivieri first version 27/02/2024
--------------------------------------------------------------------------------------

[](#about-laravelopenapimanager-authorignacio-sebastian-olivieri-first-version--27022024)

To do a best Documentation to work on a team I think 27/02/2024 to start create an application to create very fast the annotations on each Controller of laravel to use with Swagger

- [Swagger-OpenAPI Specification](https://swagger.io/docs/specification/about/).

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

[](#requirements)

To work with this Package is essential observe rules

- Use Correct Names of Controllers and Models this code is based on this logic .
- Example1 Controller ( ProductsController ) Model (Product) OK
- Example2 Controller ( ProdController ) Model (Products) BAD!
- You can use Resources Routes and Personal Routes of your Controller, Only in : dir routes/api.php OK

`Mandatory`

- Step1 Create Controller with methods
- Step2 Create Migration Table
- Step3 Create Model
- Step4 Create Routes with methods or Routes::resource or Routes::apiResource
- Step5 Define Path of OpenApi on class Controller extends BaseController
-

```
/**
* @OA\Get(
*     path="http://localhost:8000/docs/api-docs.json",
*     @OA\Response(
*         response="200",
*         description="The data"
*     )
* )
*/
class ProductsController extends Controller
{
...

```

Step 6 Create Artisan Command
-----------------------------

[](#step-6-create-artisan-command)

```
namespace App\Console\Commands;

use Illuminate\Console\Command;
use Iomanager\Swgenerator\SwagController;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Process;
use L5Swagger\Http\Controllers\SwaggerController;
use function Laravel\Prompts\info;

class CreateSwagl5 extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'app:create-swagl5';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'This command create the Annotations Open Api 3.0 on all Controllers from API routes';

    /**
     * Execute the console command.
     */
    public function handle()
    {

        $swag = new SwagController;
        $res = $swag->generateAnnotations();
        if ($res==="OK"){
            $this->info('The json file was generated!');
        }else{
            $this->info('JSON NOT created!') ;
        }

    }
}

```

Step7 add to config/filesystem.php on disk
------------------------------------------

[](#step7-add-to-configfilesystemphp-on-disk)

```
        'storage' => [
            'driver' => 'local',
            'root' => storage_path('api-docs'),
            'throw' => false,
        ],

```

- After the creation of all method in YourController you can run the next command
- Artisan Commands : to add Annotations on your controller you need use command this will generate the Annotations for each Api Method

```
php artisan app:create-swagl5

```

- Thi documentation and code is under Construction actually work but need more Parameters this will be do from me ;).
- Mandatory : The parameters passed from Url as follow
-
- Routes
- Route::post('/product/{id}/{price}', \[ProductsController::class,'myMethod'\]);
- This {id}/{price} parameters are the fields of the DB table so you need write the names equals as reflection of tabel
- Route::post('/product/{id}/{price}', \[ProductsController::class,'myMethod'\]); OK!
- |--Table
- |-------- id
- |-------- name
- |-------- price
- |-------- description
- Route::post('/product/{id\_prod}/{price\_product}', \[ProductsController::class,'myMethod'\]); BAD!
- |--Table
- |-------- id
- |-------- name
- |-------- price
- |-------- description

Extra Parameters in personal route
----------------------------------

[](#extra-parameters-in-personal-route)

- Example route tha isn't a Resource but a new route with personal parameters this route specify a new method on the Controller of your interes to the first
-
- parameter {id\_prod} corresponding the first type equal to next parameters ..
-

```
Route::post('/add/product/{id_prod}/{price}/{extra}', [ProductsController::class,'myMethod2']);

```

Image Example
-------------

[](#image-example)

[![alt text](https://github.com/ignades/IoManager/raw/main/Types.jpeg?raw=true)](https://github.com/ignades/IoManager/blob/main/Types.jpeg?raw=true)

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 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://www.gravatar.com/avatar/6134ea3eade3f5c4f7f6a37316c1829232415f790ad368bc3628de6133f171d3?d=identicon)[ignades](/maintainers/ignades)

---

Top Contributors

[![ignades](https://avatars.githubusercontent.com/u/12799639?v=4)](https://github.com/ignades "ignades (1 commits)")

### Embed Badge

![Health badge](/badges/iomanager-swgenerator/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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