2.1.3
New Feature: Custom File Locations for API Generator
Introducing a powerful addition to the API Toolkit: create custom file locations for API groups easily. This feature allows you to structure your codebase precisely as your project demands.
How It Works
When generating a new group with the API Generator, specify custom locations for models, controllers, and more. Enjoy a flexible and well-organized codebase tailored to your project needs.
Documentation
For details on using this feature, refer to the documentation. Here
Quick Guide
Open config/api-tool-kit.php
.
Under groups_files_paths
, define custom file locations for each file type in your new group.
Example Configuration:
'groups_files_paths' => [
'v1' => [
GeneratorFilesType::MODEL => [
'folder_path' => app_path('Models'),
'file_name' => '{ModelName}.php',
'namespace' => 'App\Models',
],
// Add locations for other file types here
],
],
'groups_url_prefixes' => [
'v1' => '/api/v1',
],
Run the command to generate files for the new group:
php artisan api:generate ModelName --all --group=v1