MkApi is a Laravel-based tool designed to streamline the creation of API-related files, including models, controllers, and Swagger documentation. This project simplifies API development by providing a set of commands to generate the necessary files with Swagger support.
Here’s the updated Packages Used section with your provided packages. I've included descriptions and versions for clarity:
This project utilizes the following packages to enhance functionality and streamline development:
Package Name | Description | Version |
---|---|---|
php-open-source-saver/jwt-auth |
JWT (JSON Web Token) authentication for Laravel APIs. | ^2.7 |
darkaonline/l5-swagger |
Swagger API documentation generator for Laravel. | ^8.6 |
laravel-persian-validation |
Persian-specific validation rules for Laravel applications. | - |
larastan/larastan |
Static analysis tool for Laravel applications to detect issues in code. | ^3.0 |
spatie/laravel-backup |
Backup tool for Laravel applications, including databases and files. | ^9.1 |
You can install these packages using Composer. Run the following command to install all dependencies:
composer install
Run the following command to install the MkApi tool:
php artisan install:mkapi
To create a base controller with Swagger support, use the following command:
php artisan mkapi:baseControllerSWG
To generate a model with Swagger support, use the command below. Replace YOUR_MODEL_NAME
with the desired model name.
php artisan mkapi:ModelSWG --name=YOUR_MODEL_NAME
To create a controller with Swagger support, use the following command. Replace YOUR_CONTROLLER_NAME
with the desired controller name.
php artisan mkapi:ControllerSWG --name=YOUR_CONTROLLER_NAME
Overwrite existing files using this option:
php artisan mkapi:ModelSWG --name=YOUR_MODEL_NAME --force
Add backup packages to the project:
php artisan install:mkapi --backup
Add Persian-specific packages (e.g., laravel-persian-validation
) to the project:
php artisan install:mkapi --iran
Add Swagger documentation and code to controllers:
php artisan mkapi:ControllerSWG --name=YOUR_CONTROLLER_NAME --code
-
Ensure Laravel is installed on your system.
-
Install the MkApi tool using the following command:
php artisan install:mkapi
-
Generate models and controllers for your project using the relevant commands:
php artisan mkapi:ModelSWG --name=ProductModel php artisan mkapi:ControllerSWG --name=ProductController
We welcome contributions! If you have suggestions or improvements, feel free to:
- Create an Issue.
- Submit a Pull Request.