PHP code example of weijukeji / laravel-apifox-sync

1. Go to this page and download the library: Download weijukeji/laravel-apifox-sync library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

weijukeji / laravel-apifox-sync example snippets


'paths' => [
    'Modules/*/docs/api/*.json',
    'vendor/weijukeji/*/docs/api/*.json',
],

'module_path_pattern' => 'Modules/{module}/docs/api/*.json',
bash
php artisan apifox:sync --module=Order
text
若修改任何 Modules/*/docs/api/*.json 或 vendor/weijukeji/*/docs/api/*.json,
必须执行 php artisan apifox:sync ... 同步到 Apifox。
如果未执行,最终输出必须说明原因。
bash
php artisan vendor:publish --tag=apifox-sync-config
text
config/apifox.php
bash
php artisan apifox:sync Modules/Order/docs/api/orders.json
bash
php artisan apifox:sync \
  Modules/Order/docs/api/orders.json \
  Modules/Ticket/docs/api/tickets.json
bash
php artisan apifox:sync --module=Order
bash
php artisan apifox:sync --module=Order --module=Ticket
bash
php artisan apifox:sync --module=Order --dry-run
bash
php artisan apifox:sync --module=Order --dry-run
bash
php artisan apifox:sync --module=Order
bash
php artisan apifox:sync --module=Order
bash
php artisan apifox:sync Modules/Order/docs/api/orders.json
text
Apifox 配置缺失,请先设置: APIFOX_PROJECT_ID, APIFOX_ACCESS_TOKEN
bash
# 同步指定文件
php artisan apifox:sync Modules/Order/docs/api/orders.json

# 同步指定模块
php artisan apifox:sync --module=Order

# 同步多个模块
php artisan apifox:sync --module=Order --module=Ticket

# 同步全部配置路径中的文档
php artisan apifox:sync --all

# 预览待同步文件
php artisan apifox:sync --module=Order --dry-run