定制 bamagid/laraswagger 二次开发

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

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

bamagid/laraswagger

Composer 安装命令:

composer require bamagid/laraswagger

包简介

README 文档

README

🌍 Documentation Multilingue

ENGLISH | FRANÇAIS

ENGLISH

Introduction

bamagid/laraswagger is a Laravel package designed to automate the generation of Swagger documentation. Once installed, it requires no additional configuration. This package ensures that your API documentation is always up to date with minimal effort.

🎉 Features

  • Automatic Documentation: Generate API documentation seamlessly without running extra commands
  • Customizable Descriptions: Add custom descriptions to your endpoints via comments
  • Real-time Updates: Keep your documentation updated in real-time (default behavior)

📦 Installation

composer require bamagid/laraswagger

⚙️ Configuration

No additional setup is required post-installation. The package works out of the box. However, if you'd like to customize the title or description of your API in the Swagger documentation, you can do so by editing the .env file.

APP_NAME: The title of your API
APP_DESCRIPTION: The description of your APP

🛠️ Usage

Adding Descriptions to Endpoints

To document an endpoint, use a @summary comment above the corresponding function:

/**
 * @summary This endpoint performs a specific action
 * Additional comments can go here.
 */
public function exampleFunction() {
    // Your code
}

Environment Variable

Control real-time documentation updates with the AUTO_GENERATE_DOCS environment variable:

  • true (default): Real-time documentation updates
  • false: Manual documentation generation

Add to your .env file:

AUTO_GENERATE_DOCS=true

Command

When AUTO_GENERATE_DOCS is set to false, generate documentation using:

php artisan swagger:generate

Accessing the Documentation

The generated Swagger documentation is available at the following route:

/api/documentation

FRANÇAIS

Introduction

bamagid/laraswagger est un package Laravel conçu pour automatiser la génération de documentation Swagger. Une fois installé, il ne nécessite aucune configuration supplémentaire. Ce package garantit que votre documentation API reste toujours à jour avec un minimum d'effort.

🎉 Fonctionnalités

  • Documentation automatique : Génération de documentation API sans commandes supplémentaires
  • Descriptions personnalisables : Ajout de descriptions aux endpoints via commentaires
  • Mises à jour en temps réel : Documentation automatiquement mise à jour (par défaut)

📦 Installation

composer require bamagid/laraswagger

⚙️ Configuration

Aucune configuration supplémentaire requise après l'installation.

Si vous souhaitez personnaliser le titre ou la description de votre API dans la documentation Swagger, vous pouvez le faire en modifiant votre fichier .env.

APP_NAME: The title of your API
APP_DESCRIPTION: The description of your APP

🛠️ Utilisation

Description des endpoints

/**
 * @summary Cet endpoint exécute une action spécifique
 * D'autres commentaires peuvent être ajoutés ici.
 */
public function exempleFunction() {
    // Votre code
}

Variable d'environnement

AUTO_GENERATE_DOCS=true

Commande

php artisan swagger:generate

Accéder à la Documentation

La documentation Swagger générée est disponible à l'adresse suivante :

/api/documentation

统计信息

  • 总下载量: 445
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固