PHPackages                             sdv/laravel-endpoint - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. sdv/laravel-endpoint

ActiveLibrary[HTTP &amp; Networking](/categories/http)

sdv/laravel-endpoint
====================

Laravel Endpoint is a CRUD REST API package for Laravel.

v5.8.0(5y ago)1118.8k1[5 issues](https://github.com/SDV-Plurimedia/laravel-endpoint/issues)[2 PRs](https://github.com/SDV-Plurimedia/laravel-endpoint/pulls)MITPHPPHP &gt;=7.1CI failing

Since Jan 25Pushed 2y ago4 watchersCompare

[ Source](https://github.com/SDV-Plurimedia/laravel-endpoint)[ Packagist](https://packagist.org/packages/sdv/laravel-endpoint)[ RSS](/packages/sdv-laravel-endpoint/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (6)Versions (19)Used By (0)

Laravel Endpoint
================

[](#laravel-endpoint)

[![Latest Stable Version](https://camo.githubusercontent.com/d637022b3905e9bcc28da7ca307512c25866e644f37f35768022b285cd908b3c/68747470733a2f2f706f7365722e707567782e6f72672f7364762f6c61726176656c2d656e64706f696e742f762f737461626c65)](https://packagist.org/packages/sdv/laravel-endpoint)[![License](https://camo.githubusercontent.com/e75f1b636114a4bdb0ea1d4ee5d35230d45337d2aa6760da64d38bb3499dce8f/68747470733a2f2f706f7365722e707567782e6f72672f7364762f6c61726176656c2d656e64706f696e742f6c6963656e7365)](https://packagist.org/packages/sdv/laravel-endpoint)[![Total Downloads](https://camo.githubusercontent.com/5682b36f393fab5a2ab330122af4191967ebed8a1701ca08451be6a5b124759f/68747470733a2f2f706f7365722e707567782e6f72672f7364762f6c61726176656c2d656e64706f696e742f646f776e6c6f616473)](https://packagist.org/packages/sdv/laravel-endpoint)[![Build Status](https://camo.githubusercontent.com/fc4972890c0657414ce964f8b2ce3cff9d2f7272416fb04cdaf3226a01e21b95/68747470733a2f2f7472617669732d63692e6f72672f5344562d506c7572696d656469612f6c61726176656c2d656e64706f696e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/SDV-Plurimedia/laravel-endpoint)

Laravel Endpoint is a CRUD REST API package for Laravel.

Features
--------

[](#features)

- REST CRUD Endpoint scaffolding
- Normalized JSON Response using [laravel-fractal](https://github.com/spatie/laravel-fractal)
- Simple filtering operations
- Ability to customize fractal serializer
- Ability to customize filtering and sorting strategies
- [Elasticsearch](https://www.elastic.co/products/elasticsearch) / [Algolia](https://www.algolia.com/) search
- Api Documentation ([Swagger](http://swagger.io/swagger-ui/), [API Blueprint](https://apiblueprint.org/))

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

[](#installation)

You can pull in the package via composer:

```
$ composer require sdv/laravel-endpoint

```

Register the service provider.

```
// config/app.php
'providers' => [
    ...
    SdV\Endpoint\EndpointServiceProvider::class,
]

```

Replace the render method in `app/Exceptions/Handler.php`.

```
use SdV\Endpoint\ProvidesExceptionsHandler;

class Handler extends ExceptionHandler
{
    use ProvidesExceptionsHandler;

    ...

    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $exception
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $exception)
    {
        if ($this->isRequestForApi($request)) {
            return $this->renderJson($exception, $request);
        }

        return parent::render($request, $exception);
    }

    ...
}

```

Testing
-------

[](#testing)

```
composer test

```

Commands Usage
--------------

[](#commands-usage)

### Create a new endpoint

[](#create-a-new-endpoint)

```
php artisan endpoint:make:all Post v1

```

This will create all this files.

- app/Post.php
- app/Repositories/PostRepository.php
- app/Transformers/PostTransformer.php
- app/Http/Controllers/Api/V1/PostController.php

Options:

- --mongo : Generate a Laravel-MongoDB compatible Model. (You need to install  in your app)
- --module=Modules\\Search : Generate all the files under the App\\Modules\\Search namespace.

```
    - app
        - Modules
            - Search
                - Http\Controllers\Api\V1
                - Models
                - Repositories
                - Transformers
    - bootstrap
    - config
    - database
    - ...

```

Then, you need to register your api routes.

```
// routes/api.php
Route::group(['namespace' => 'Api\V1', 'prefix' => 'v1'], function () {
    Route::resource('posts', 'PostController', ['except' => [
        'create', 'edit'
    ]]);
});

```

### Create a new model class.

[](#create-a-new-model-class)

```
php artisan endpoint:make:model Post

```

This will create the file `app/Post.php` and insert the minimum boilerplate with filtrable trait.

Optionnaly, you can add the --mongo flag to generate a Laravel-MongoDB compatible Model.

### Create a new controller class.

[](#create-a-new-controller-class)

```
php artisan endpoint:make:controller Post v1

```

This will create the file `app/Http/Controllers/Api/V1/PostController.php` and insert the minimum boilerplate.

### Create a new repository class.

[](#create-a-new-repository-class)

```
php artisan endpoint:make:repository Post

```

This will create the file `app/Repositories/PostRepository.php` and insert the minimum boilerplate.

### Create a new transformer class.

[](#create-a-new-transformer-class)

```
php artisan endpoint:make:transformer Post

```

This will create the file `app/Transformers/PostTransformer.php` and insert the minimum boilerplate.

API Usage
---------

[](#api-usage)

### Pagination

[](#pagination)

#### Change the selected page

[](#change-the-selected-page)

```
/api/v1/topics?page=2

```

#### Change the number of items per page

[](#change-the-number-of-items-per-page)

```
/api/v1/topics?per_page=50

```

### Returns all

[](#returns-all)

```
/api/v1/topics?limit=all

```

### Filters

[](#filters)

The `and` filter is applied by default.

#### And Filter

[](#and-filter)

```
/api/v1/topics?filter[]=name,eq,laravel&filter[]=name,eq,eloquent&satisfy=all

```

#### Or Filter

[](#or-filter)

```
/api/v1/topics?filter[]=name,eq,laravel&filter[]=name,eq,eloquent&satisfy=any

```

### Sort

[](#sort)

```
/api/v1/topics?sort=name

```

```
/api/v1/topics?sort=-name

```

```
/api/v1/topics?sort=-slug,name

```

### Includes

[](#includes)

Update your transformer to add your include rules, according to fractal docs ()

Then you can include related models on your calls

```
/api/v1/topics?include=posts,posts.author

```

Error responses
---------------

[](#error-responses)

- Bad request (400) `$this->badRequest('The request was unacceptable.')`
- Unauthorized (401) `$this->unauthorized('No valid API key was provided.')`
- Forbidden (403) `$this->forbidden('Access forbidden.')`
- Not found (404) `$this->notFound('Resource not found.')`
- Method not allowed (405) `$this->methodNotAllowed('The HTTP method is not allowed.')`
- Unprocessable entity (422) `$this->unprocessableEntity('Invalid fields.')`
- Too many requests (429) `$this->tooManyRequests('Too many requests hit the API.')`
- Server error (500) `$this->serverError('Internal server error.')`

Note: The `ProvidesExceptionsHandler` comes with default support for the following exceptions:

- Illuminate\\Database\\Eloquent\\ModelNotFoundException
- Illuminate\\Validation\\ValidationException
- Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException
- Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException

Credits
-------

[](#credits)

-
-

License
-------

[](#license)

Laravel Endpoint is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance11

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 97.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

Every ~104 days

Recently: every ~321 days

Total

14

Last Release

2090d ago

Major Versions

v0.2.1 → v5.8.02020-10-09

PHP version history (2 changes)v0.1.0PHP &gt;=5.5.0

v0.2.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/569d758aa4ae4d599d4b3145f9d30e72da3052745389e2ab54ad978641e0879b?d=identicon)[SDV Plurimédia](/maintainers/SDV%20Plurim%C3%A9dia)

---

Top Contributors

[![fabriceclementz](https://avatars.githubusercontent.com/u/1771483?v=4)](https://github.com/fabriceclementz "fabriceclementz (42 commits)")[![Gitoliv](https://avatars.githubusercontent.com/u/13965957?v=4)](https://github.com/Gitoliv "Gitoliv (1 commits)")

---

Tags

apilaravellaravel-5-packagelaravel-endpointapisearchlaravelrestscaffolding

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sdv-laravel-endpoint/health.svg)

```
[![Health](https://phpackages.com/badges/sdv-laravel-endpoint/health.svg)](https://phpackages.com/packages/sdv-laravel-endpoint)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)

PHPackages © 2026

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