Download the PHP package kaxiluo/swagger-laravel-code-generator without Composer

On this page you can find all versions of the php package kaxiluo/swagger-laravel-code-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package swagger-laravel-code-generator

swagger-laravel-code-generator

根据swagger文档自动生成laravel模型,资源,控制器,路由

安装

Packagist

使用方法

php artisan swagger-to-code:gen ./docs/your-openapi.yaml --ignored-schema-regular=^Error* --all --force

参数:

~ 运行一个例子试试 php artisan swagger-to-code:gen ./vendor/kaxiluo/swagger-laravel-code-generator/example-swagger/example-openapi.yaml --ignored-schema-regular=^Error* --all

模型 && 资源

根据文档中的 schemas 生成对应的模型和资源类,默认不会生成User模型

可选参数:--ignored-schema-regular=

参数说明:忽略文档中模型的正则表达式,示例中 --ignored-schema-regular=^Error* 表示不生成以Error开头的模型和资源

举个栗子,如果swagger中定义有如下schema:

生成的模型:Article Comment Author

生成的资源:

app/Http/Resources/ArticleResource.php

app/Http/Resources/AuthorResource.php

app/Http/Resources/ArticleDetailResource.php

app/Http/Resources/CommentResource.php

控制器 && 路由

根据文档中 paths 定义的 operationId 生成对应的控制器和路由,如果没有定义operationId将不会生成控制器和路由

举个栗子,如果swagger中定义

生成的控制器:

app/Controllers/Article/ArticleController.php , 类中包含index方法

生成的路由:

Route::get('/articles', 'Article\ArticleController@index');


All versions of swagger-laravel-code-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.3
laravel/framework Version >=5.8
symfony/yaml Version ^5.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kaxiluo/swagger-laravel-code-generator contains the following files

Loading the files please wait ....