Skip to main content
Projects / juststeveking/laravel-api-toolkit

juststeveking/laravel-api-toolkit

A toolkit for creating APIs in Laravel

24
Stars
📦
415
Downloads
📈
2
Monthly

A toolkit for creating APIs in Laravel

A toolkit for creating APIs in Laravel.

Installation

You can install the package via composer:

composer require juststeveking/laravel-api-toolkit

You can publish the config file with:

php artisan vendor:publish --provider="JustSteveKing\Laravel\ApiToolkit\ApiToolkitServiceProvider" --tag="config"

This is the contents of the published config file:

return [
    'resource_name' => '%sResource',
    'policy_name' => '%sPolicy',
    'seeder_name' => '%sSeeder',
    'controllers' => [
        [
            'name' => 'IndexController',
            'options' => [
                '--invokable',
            ]
        ],
        [
            'name' => 'CreateController',
            'options' => [
                '--invokable',
            ]
        ],
        [
            'name' => 'ShowController',
            'options' => [
                '--invokable',
            ]
        ],
        [
            'name' => 'UpdateController',
            'options' => [
                '--invokable',
            ]
        ],
        [
            'name' => 'DeleteController',
            'options' => [
                '--invokable',
            ]
        ],
    ],
    'form_requests' => [
        'CreateRequest',
        'UpdateRequest',
    ],
];

Usage

To get starteed using this, there is only one command you really need to worry about: api-toolkit:resource.

The only option you need to pass it is the eloquent Model you wish to create and create the APi blueprint for.

php artisan api-toolkit:resource Post

The above command will generate:

  • app/Models/Post.php
  • app/Policies/PostPolicy.php - Class name can be altered in config
  • app/Http/Resources/PostResource.php - Class name can be altered in config
  • app/Http/Requests/Api/Post/CreateRequest.php - Class name can be altered in config
  • app/Http/Requests/Api/Post/UpdateRequest.php - Class name can be altered in config
  • app/Http/Controllers/Post/IndexController.php - Class name can be altered in config
  • app/Http/Controllers/Post/CreateController.php - Class name can be altered in config
  • app/Http/Controllers/Post/ShowController.php - Class name can be altered in config
  • app/Http/Controllers/Post/UpdateController.php - Class name can be altered in config
  • app/Http/Controllers/Post/DeleteController.php - Class name can be altered in config
  • database/seeds/PostSeeder.php - Class name can be altered in config
  • database/factories/PostFactory.php
  • database/migrations/xxxx_xx_xx_xxxxxx_create_posts_table.php

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Last updated: 12/5/2025
← Back to all projects
NORMAL
~/projects
command-repl
NORMAL ESC
# Command REPL - Type 'help' for available commands
↑↓ history Tab complete Enter execute
Ctrl+C clear ESC close