定制 exonn-gmbh/scramble-spatie-query-builder 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

exonn-gmbh/scramble-spatie-query-builder

最新稳定版本:v1.0.5

Composer 安装命令:

composer require exonn-gmbh/scramble-spatie-query-builder

包简介

This is the Scramble extension, which detects the usage of the Spatie query builder and adds applicable query parameters to the openapi definitions

README 文档

README

Preview

Introduction

This is the Scramble extension, which detects the usage of the Spatie query builder in your api routes and automatically adds applicable query parameters to the openapi definition.

Installation

composer require exonn-gmbh/scramble-spatie-query-builder

Usage

  1. Register the extension in your config/scramble.php file
'extensions' => [
    // ...
    \Exonn\ScrambleSpatieQueryBuilder\AllowedFieldsExtension::class,
    \Exonn\ScrambleSpatieQueryBuilder\AllowedSortsExtension::class,
    \Exonn\ScrambleSpatieQueryBuilder\AllowedFiltersExtension::class,
    \Exonn\ScrambleSpatieQueryBuilder\AllowedIncludesExtension::class,
//    \Exonn\ScrambleSpatieQueryBuilder\AllowedFilterModesExtension::class
],
  1. You are done, now check your Scramble docs for routes that use Spatie query builder, you should see new query parameters documented

Customization

By default this extension automatically updates openapi definition for you, but if you want to customize its default behaviour, you can do it in the following way

  1. Open your AppServiceProvider.php and add the following code example in the boot method
public function boot(): void
{
    // ...
    AllowedIncludesExtension::hook(function(Operation $operation, Parameter $parameter) {
        // Customize the example
        $parameter->example(['repositories.issues', 'repositories']);
        // Customize the description
        $parameter->description('Allows you to include additional model relations in the response');
    });
}
  1. Customize for your needs

统计信息

  • 总下载量: 3.67k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-28