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

ActiveLibrary[API Development](/categories/api)

bleuren/laravel-api
===================

A package to develop APIs with Laravel using Repository and Service patterns

v1.0.4(1y ago)08163MITPHPPHP ^8.3

Since Sep 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/bleuren/laravel-api)[ Packagist](https://packagist.org/packages/bleuren/laravel-api)[ Docs](https://github.com/bleuren/laravel-api)[ RSS](/packages/bleuren-laravel-api/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Laravel API Package
===================

[](#laravel-api-package)

A robust Laravel package for implementing the Repository and Service patterns in your API development. This package provides a solid foundation for building scalable and maintainable APIs by separating concerns and promoting clean code architecture.

Features
--------

[](#features)

- Base Repository and Service classes
- Artisan commands for generating Repositories and Services
- Automatic binding of Repositories and Services in the Service Container
- JSON response handling
- Easy integration with Laravel projects

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11.0+

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

[](#installation)

1. Add the package to your Laravel project:

```
composer require bleuren/laravel-api
```

2. Publish the package configuration (optional):

```
php artisan vendor:publish --provider="Bleuren\LaravelApi\Providers\LaravelApiServiceProvider" --tag="config"
```

Usage
-----

[](#usage)

### Creating a Repository

[](#creating-a-repository)

To create a new repository, use the following Artisan command:

```
php artisan make:repository User
```

This will create a new `UserRepository` class in the `app/Repositories` directory and a corresponding `UserRepositoryInterface` in the `app/Contracts` directory.

### Creating a Service

[](#creating-a-service)

To create a new service, use the following Artisan command:

```
php artisan make:service User
```

This will create a new `UserService` class in the `app/Services` directory and a corresponding `UserServiceInterface` in the `app/Contracts` directory.

### Using Repositories and Services in Controllers

[](#using-repositories-and-services-in-controllers)

After creating your repositories and services, you can use them in your controllers like this:

```
use App\Contracts\UserServiceInterface;

class UserController extends Controller
{
    protected $userService;

    public function __construct(UserServiceInterface $userService)
    {
        $this->userService = $userService;
    }

    public function index()
    {
        return $this->userService->all();
    }

    public function show($id)
    {
        return $this->userService->find($id);
    }

    // ... other methods
}
```

Extending Base Classes
----------------------

[](#extending-base-classes)

You can extend the base Repository and Service classes to add custom functionality:

```
use Bleuren\LaravelApi\BaseRepository;
use App\Models\User;

class UserRepository extends BaseRepository
{
    public function __construct(User $model)
    {
        parent::__construct($model);
    }

    // Add custom methods here
}
```

```
use Bleuren\LaravelApi\BaseService;
use App\Contracts\UserRepositoryInterface;

class UserService extends BaseService
{
    public function __construct(UserRepositoryInterface $repository)
    {
        parent::__construct($repository);
    }

    // Add custom methods here
}
```

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

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

4

Last Release

669d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22718976?v=4)[Bleu Ren](/maintainers/bleuren)[@bleuren](https://github.com/bleuren)

---

Top Contributors

[![bleuren](https://avatars.githubusercontent.com/u/22718976?v=4)](https://github.com/bleuren "bleuren (7 commits)")

---

Tags

apilaravelservicerepositorybleuren

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[essa/api-tool-kit

set of tools to build an api with laravel

53390.1k](/packages/essa-api-tool-kit)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6804.7k6](/packages/hasinhayder-tyro)

PHPackages © 2026

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