medianet-dev/api-tool-kit

Set of tools to build an api with laravel

1.3.0 2024-02-21 17:33 UTC

This package is auto-updated.

Last update: 2024-12-21 19:21:27 UTC


README

Latest Version on Packagist Total Downloads

Introduction

Elevate your development journey with high-performance APIs using the API Toolkit. Supercharge your API development with standardized responses, dynamic pagination, advanced filtering, and a one-click full CRUD setup. Let's take your APIs to the next level!

Installation

to install the package using Composer:

composer require medianet-dev/api-tool-kit

Why Choose the Laravel API Toolkit?

Consistent Responses, Less Hassle

The API Response feature simplifies generating consistent JSON responses. It provides a standardized format for your api responses:

{
    "base_url": "APP_URL",
    "status": true,
    "message": "OK",
    "status_code": 200,
    "message": "your message",
    "data": [
      ...
    ]
}

Pagination Done Right

Don't fuss over managing the number of results per page. The dynamic pagination feature adapts effortlessly to your needs, giving you control without complications.

$users = User::dynamicPaginate();

Simplified Filtering

Refine query results with simplicity. The powerful filtering system lets you filter, sort, search, and even include relationships with ease.

Car::useFilters()->get();

Simplify API Setup with the API Generator

The API Generator automates file setup, creating key files from migrations to controllers. Use one command to kickstart your API development.

php artisan api:generate ModelName --all

Schema Support

Enhance the API Generator with schema support, allowing you to define your database table structure directly from the command line. Generate factory model migrations, requests, and data based on this schema.

php artisan api:generate ModelName "column1:string|column2:integer|column3:datetime"

Logic Made Clear

Tackle complex business logic with Actions. These gems follow the command pattern, boosting readability and maintenance for your code.

app(CreateCar::class)->execute($data);

Media? Handled.

Handle file uploads and deletions like a pro. The Media Helper streamlines media management, leaving you with clean and organized file handling.

$filePath = MediaHelper::uploadFile($file, $path);

Enums for Clarity

The Enum class provides a way to work with enumerations, eliminating hardcoded values in your code:

namespace App\Enums;

class UserTypes extends Enum
{
    public const ADMIN = 'admin';
    public const STUDENT = 'student';
}

License

By contributing to the Laravel API Toolkit, you agree that your contributions will be licensed under the project's MIT License.