PHPackages                             devlabor/laravel-api - 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. devlabor/laravel-api

ActiveLibrary[API Development](/categories/api)

devlabor/laravel-api
====================

Laravel Package for building REST API rapidly.

v2.0.1(3y ago)11.2kMITPHPPHP ^8.0CI failing

Since Aug 7Pushed 3y ago2 watchersCompare

[ Source](https://github.com/DevLabor/laravel-api)[ Packagist](https://packagist.org/packages/devlabor/laravel-api)[ Docs](https://github.com/devlabor/laravel-api)[ RSS](/packages/devlabor-laravel-api/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (7)Dependencies (6)Versions (9)Used By (0)

Laravel Package for building REST API rapidly.
==============================================

[](#laravel-package-for-building-rest-api-rapidly)

[![Latest Version on Packagist](https://camo.githubusercontent.com/05bda138f04b9c49479fcfedb09f8780aa1e949c8b16328dd31c6dac7ea824ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465766c61626f722f6c61726176656c2d617069)](https://packagist.org/packages/devlabor/laravel-api)[![GitHub Tests Action Status](https://camo.githubusercontent.com/f57798761c84204c4b08f69b0f1d59ea6b3ef42e9a8ccc212c067a1ba2cc726b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6465766c61626f722f6c61726176656c2d6170692f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/devlabor/laravel-api/actions?query=workflow%3Arun-tests+branch%3Amaster)[![Sonarcloud Status](https://camo.githubusercontent.com/a9928df78828c4606abb1e7f1fea0a9402710abef0f0ff202d4b4fd834b3bd03/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d4465764c61626f725f6c61726176656c2d617069266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=DevLabor_laravel-api)[![Total Downloads](https://camo.githubusercontent.com/cd4673d962ec2d10ea12e84d95f8d475291b976b32a738ee764fd981706ebdf1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465766c61626f722f6c61726176656c2d6170693f7374796c653d666c6174)](https://packagist.org/packages/devlabor/laravel-api)

This package is based on "spatie/laravel-query-builder" allows you to rapidly creating API controllers for your Laravel application. This package also works with authorization policies.

Basic Usage
-----------

[](#basic-usage)

Create a new API controller: `ProductApiController`:

```
use DevLabor\Api\Http\Controllers\ApiController;

// ...

class ProductApiController extends ApiController
{
// ...
}
```

Extend your API routes within `routes/api.php`:

```
// ...

Route::resource('products', 'Api\ProductApiController');
```

Sometimes you need an identifcation for the object in your api. For this reason, you can use the `DevLabor\Api\Http\Resources\ApiResource` as base class for your own resource classes:

```
use DevLabor\Api\Http\Resources\ApiResource;

class Product extends ApiResource
{
//
}
```

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

[](#installation)

You can install the package via composer:

```
composer require devlabor/laravel-api
```

You can optionally publish the config file with:

```
php artisan vendor:publish --tag=api
```

This is the contents of the published config file:

```
return [
	'pagination' => [
		/**
		 * Number of items per page returned in index()
		 */
		'items' => 20
	]
];
```

Usage
-----

[](#usage)

### Configure policy authorization

[](#configure-policy-authorization)

By adapting the `$authorizeAbilities` member in the controller class, the authorization check can be partially restricted.

```
// ...

protected $authorizeAbilities = [
	'viewAny', // index
	'view', // show
	'store',
	'update',
	'destroy'
];
```

For more information about policies, take a look at Laravel's [Creating Policies](https://laravel.com/docs/9.x/authorization#creating-policies)

### Disable policy authorization

[](#disable-policy-authorization)

You are able to disable the complete check with following member change in your controller class.

```
protected $authorizeAbilities = false;
```

### Configure custom paths

[](#configure-custom-paths)

```
    /**
     * Models location
     * @var string
     */
    protected $modelPath = 'App\\Models\\';

    /**
     * Resources location
     * @var string
     */
    protected $resourcePath = 'App\\Http\\Resources\\';
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 91.3% 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 ~180 days

Recently: every ~261 days

Total

7

Last Release

1389d ago

Major Versions

v1.0.4 → v2.0.02022-07-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ac49f4d8027a3933d11793db700eeef391cfbded9a6ed612778c6fe39fd0ae2?d=identicon)[Kiv4h](/maintainers/Kiv4h)

---

Top Contributors

[![Kiv4h](https://avatars.githubusercontent.com/u/1305053?v=4)](https://github.com/Kiv4h "Kiv4h (42 commits)")[![aaron-p1](https://avatars.githubusercontent.com/u/62202958?v=4)](https://github.com/aaron-p1 "aaron-p1 (4 commits)")

---

Tags

apilaravelspatieapilaravellaravel-query-builderdevlabor

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/devlabor-laravel-api/health.svg)

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

###  Alternatives

[spatie/laravel-fractal

An easy to use Fractal integration for Laravel applications

1.9k15.1M99](/packages/spatie-laravel-fractal)[rupadana/filament-api-service

A simple api service for supporting filamentphp

204103.8k7](/packages/rupadana-filament-api-service)[d-scribe/laraquick

A collection of classes to be extended/used in laravel applications for quick development

371.8k1](/packages/d-scribe-laraquick)

PHPackages © 2026

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