dogukantokgoz/route-to-postman 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dogukantokgoz/route-to-postman

Composer 安装命令:

composer require dogukantokgoz/route-to-postman

包简介

Generate Postman collections directly from Laravel routes with structured grouping and documentation.

README 文档

README

Latest Version

Generate organized Postman collections directly from your Laravel routes with intelligent automation.

Route to Postman

Features

📂 Smart File Structure

The package automatically organizes your Postman collection based on your route prefixes.

  • Folders: Created based on the route prefix (e.g., api/users -> users folder).
  • Requests: Named using the controller method in PascalCase (e.g., UserController@store -> Store).
  • Filtering: Routes defined in routes/api.php that do not have a valid controller method are automatically skipped to keep your collection clean.

📝 Intelligent Body Generation

The package analyzes your code to generate sample request bodies for POST, PUT, and PATCH requests.

  1. FormRequest: If a method uses a FormRequest, validation rules are used to generate the body.
  2. Model Inference: If no FormRequest is used, the package infers the Model from the Controller name (e.g., ProductController -> Product model). It then uses the model's fillable attributes to generate the request body.

🔐 Automated Authentication

Forget about manually copying and pasting tokens!

  1. Login Detection: The package automatically finds routes ending in login or containing auth/login.
  2. Auto-Script Injection: A Postman test script is injected into the login request to capture the token.
  3. Smart Bearer Token Assignment: Bearer token is automatically added to routes that have middleware assigned. Public routes (without middleware) and excluded routes will not receive bearer token authentication.

Expected Login Response: The script expects the token to be in data.token. Example:

{
    "success": true,
    "message": "Login successful",
    "data": {
        "token": "your_generated_token_here"
    }
}

Once you run the Login request in Postman, the token is automatically saved and used for all other requests.

Bearer Token Rules:

  • Added to: Routes with any middleware (except api middleware which is automatically added by Laravel)
  • Not added to:
    • Routes without middleware (public routes)
    • Routes matching patterns in excluded_routes config (login, register, password reset, email verification, etc.)

Excluded Routes Configuration: You can configure which routes should not receive bearer token in config/postman.php:

'excluded_routes' => [
    // Authentication routes
    'login',
    'register',
    'auth/google',
    'auth/facebook',
    
    // Password reset routes
    'password-reset',
    'password/reset',
    'password/email',
    '/password/reset',
    'forgot-password',
    'forgotpassword',
    'reset-password',
    'resetpassword',
    
    // Email verification routes
    'email/verify',
    'email/resend',
    '/email/verify',
    '/email/resend',
],

⚙️ Configuration

  • Collection Name: The Postman collection name is taken from your APP_NAME environment variable (defaults to 'Laravel Routes').

Installation

composer require dogukantokgoz/route-to-postman

Publish the configuration file:

php artisan vendor:publish --provider="dogukantokgoz\Route2Postman\PostmanServiceProvider" --tag=postman-config

Usage

Run the command to generate your collection:

php artisan route:export

The collection will be saved to storage/postman/route_collection.json. Import this file into Postman.

License

MIT

dogukantokgoz/route-to-postman 适用场景与选型建议

dogukantokgoz/route-to-postman 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 4, 最近一次更新时间为 2025 年 12 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 dogukantokgoz/route-to-postman 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dogukantokgoz/route-to-postman 我们能提供哪些服务?
定制开发 / 二次开发

基于 dogukantokgoz/route-to-postman 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 38
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-03