mk990/mkapi 问题修复 & 功能扩展

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

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

mk990/mkapi

最新稳定版本:v0.1.3

Composer 安装命令:

composer require mk990/mkapi

包简介

api helper for laravel

README 文档

README

GitHub stars

GitHub license

MkApi Logo

🚀 API Development with Laravel MkApi

MkApi is a Laravel-based CLI tool that simplifies API development by generating essential files like models, controllers, and Swagger documentation — all with a single command. It’s designed to help you build faster, cleaner, and more documented APIs. 🧰✨

📦 Packages Used

This project utilizes the following packages to boost development and maintain high standards:

📦 Package Name 📝 Description 🔢 Version
l5-swagger Swagger API documentation generator for Laravel. ^8.6
jwt-auth JSON Web Token (JWT) authentication for secure APIs. ^2.7
larastan Static analysis tool to catch bugs early using PHPStan for Laravel. ^3.0
laravel-backup Seamless backup of databases and files in Laravel apps. ^9.1
laravel-pulse Real-time performance insights for Laravel applications. ^1.4
laravel-telescope Debugging assistant for Laravel. Monitors requests, logs, queries, mail, jobs, and more. ^5.8
laravel-persian-validation Persian-specific validation rules for form requests. ^2.0
verta Date handling between Solar and Gregorian calendars. ^8.5
turnstile Easy integration with Cloudflare Turnstile for bot protection. ^2.0

⚙️ Installation

📥 Install MkApi Tool

composer require mk990/mkapi --dev
php artisan install:mkapi

🔧 The following packages are installed by default:

  • l5-swagger
  • jwt-auth
  • larastan

🎛️ Install Optional Packages

Use the interactive install command to choose additional tools:

php artisan install:mkapi --package

📌 Available packages:

  • laravel-backup
  • laravel-pulse
  • laravel-telescope
  • laravel-persian-validation
  • verta
  • turnstile

🛠️ Usage

MkApi provides easy-to-use artisan commands to generate models and controllers with Swagger support.

🧱 Generate a Model

php artisan mkapi:Model YOUR_MODEL_NAME

✅ Examples:

php artisan mkapi:Model product
php artisan mkapi:Model all

🎮 Generate a Controller

php artisan mkapi:Controller YOUR_CONTROLLER_NAME

✅ Examples:

php artisan mkapi:Controller product
php artisan mkapi:Controller all

🧩 Command Options

🔁 --force: Overwrite Existing Files

php artisan mkapi:Model product --force

This will replace any existing ProductModel.php file.

🧾 --code: Add Swagger Documentation & Controller Logic

php artisan mkapi:Controller product --code

🧠 Example generated method in ProductController.php:

public function store(Request $request): JsonResponse
{
    $validated = $request->validate([
        'name' => 'required|string|max:255',
    ]);

    try {
        return $this->success(Product::create($validated));
    } catch (Exception $e) {
        Log::error($e->getMessage());
        return $this->error('create error');
    }
}

➡️ Explore more generated methods in the TestController file.

🤝 Contributing

We love contributions! If you have ideas or improvements, feel free to:

📝 License

This project is licensed under the MIT License.

👥 Contributors

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2024-11-17