PHPackages                             chiariello/laravel-api-crud-maker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. chiariello/laravel-api-crud-maker

ActiveLibrary[API Development](/categories/api)

chiariello/laravel-api-crud-maker
=================================

Package to create an api CRUD with filters

0.1.0(2y ago)011MITPHPPHP ^8.1

Since Sep 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/chiariello/laravel-api-crud-maker)[ Packagist](https://packagist.org/packages/chiariello/laravel-api-crud-maker)[ Docs](https://github.com/chiariello/laravel-api-crud-maker)[ RSS](/packages/chiariello-laravel-api-crud-maker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (2)Used By (0)

Create API CRUD with filters
============================

[](#create-api-crud-with-filters)

Create API CRUD with filters in Laravel project

Installation
------------

[](#installation)

Via composer:

```
composer require chiariello/laravel-api-crud-maker
```

Add FilterServiceProvider and RequestServiceProvider in config/app.php

```
    'providers' => ServiceProvider::defaultProviders()->merge([
        /*
         * Package Service Providers...
         */

        /*
         * Application Service Providers...
         */
        App\Providers\AppServiceProvider::class,
        App\Providers\AuthServiceProvider::class,
        // App\Providers\BroadcastServiceProvider::class,
        App\Providers\EventServiceProvider::class,
        App\Providers\RouteServiceProvider::class,
        Chiariello\LaravelApiCrudMaker\Providers\FilterServiceProvider::class, // id();
    $table->string('departure');
    $table->string('destination');
    $table->timestamps();
});
```

Add HasFilters trait and fillables attributes in model

```
namespace App\Models;

use Chiariello\LaravelApiCrudMaker\Traits\HasFilters;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Flight extends Model
{
    use HasFactory, HasFilters;

    protected $fillable = [
        'departure',
        'destination'
    ];
}
```

Extend CrudController and set $model attribute in Controller class

```
namespace App\Http\Controllers;

use App\Models\Flight;
use Chiariello\LaravelApiCrudMaker\Controllers\CrudController;

class FlightController extends CrudController
{
    protected string $model = Flight::class;
}
```

Create Filter class under app/Filters the class must have {ModelName}Filter.php name (in this example FlightFilters.php).

Now you need to set the filters array and insert every attribute filter and create a method for every filter.

```
namespace App\Filters;

use Chiariello\LaravelApiCrudMaker\Filters\AbstractFilters;

class FlightFilters extends AbstractFilters
{
    protected array $filters = [
        'departure',
        'destination'
    ];

    public function departure(string $departure)
    {
        $this->like('departure', $departure);
    }

    public function destination(string $destination)
    {
        $this->like('destination', $destination);
    }

}
```

create a form request with this name convention {{ModelName}}Request.php

```
php artisan make:request FlightRequest
```

Set validation and create and update logic.

```
namespace App\Http\Requests;

use App\Models\Flight;
use Illuminate\Foundation\Http\FormRequest;

class FlightRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            //
        ];
    }

    public function persist(){

        if($this->id){
            return Flight
                ::findOrFail($this->id)
                ->update($this->all());
        }
        return Flight::create($this->all());
    }
}
```

add Route in api.php

```
use App\Http\Controllers\FlightController;
use Chiariello\LaravelApiCrudMaker\Utils\RouteUtility;

RouteUtility::controllerRoutes(FlightController::class,'flights');
```

Credits
-------

[](#credits)

- [Salvatore Chiariello](https://github.com/chiariello)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

961d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a4edc07ffc6b5bc0b13fa7924830081285e44a0dc2803deb073fd5f47d380524?d=identicon)[salvatore.chiariello](/maintainers/salvatore.chiariello)

---

Top Contributors

[![salvatorechiariello](https://avatars.githubusercontent.com/u/82819523?v=4)](https://github.com/salvatorechiariello "salvatorechiariello (11 commits)")[![chiariello](https://avatars.githubusercontent.com/u/7082009?v=4)](https://github.com/chiariello "chiariello (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravellaravel-api-crud-maker

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/chiariello-laravel-api-crud-maker/health.svg)

```
[![Health](https://phpackages.com/badges/chiariello-laravel-api-crud-maker/health.svg)](https://phpackages.com/packages/chiariello-laravel-api-crud-maker)
```

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.0k7.8M57](/packages/dedoc-scramble)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)[njoguamos/laravel-plausible

A laravel package for interacting with plausible analytics api.

208.8k](/packages/njoguamos-laravel-plausible)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
