miladev/lara-swagger

Swagger model generator based on Laravel migrations

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/miladev/lara-swagger

v1.0.5 2025-11-15 08:20 UTC

This package is auto-updated.

Last update: 2025-11-15 08:22:56 UTC


README

Latest Stable Version License Total Downloads CI & Release

A Swagger model generator based on migrations

if you bored to create swagger models from your laravel application this package can help you.

Installation

You can install the package via composer:

composer require miladev/lara-swagger

Usage

php artisan lswagger:generate

This command will create swagger_models.js file which contains all models of your laravel application

Testing

This package uses PHPUnit and Orchestra Testbench.

  • Prerequisites: PHP 8.2+ and Composer
  • Install dev dependencies:
composer install

If you do not have a global Composer installed, you can use a local PHAR inside the project:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=. --filename=composer.phar
php -r "unlink('composer-setup.php');"
php composer.phar install
  • Run the tests:
composer test
# or
vendor/bin/phpunit
# or a specific test file
vendor/bin/phpunit tests/Feature/CreateSwaggerCommandTest.php

If you run tests from an IDE, ensure the working directory is the project root so the generated swagger_models.json can be found.

Roadmap

  • Support enum types
  • Support all kind of migrations (Rename,Delete,...)

If you want to contribute, open a pull request by following Laravel contribution guide.

License

The MIT License (MIT). Please see License File for more information.