PHPackages                             blaisebueno/laravel-repository - 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. [Database &amp; ORM](/categories/database)
4. /
5. blaisebueno/laravel-repository

ActiveLibrary[Database &amp; ORM](/categories/database)

blaisebueno/laravel-repository
==============================

A Laravel package implementing a clean, scalable repository design pattern architecture to abstract data persistence and promote testable, maintainable code.

v1.0.0(4mo ago)111[1 issues](https://github.com/reizucodes/laravel-repository/issues)MITPHPPHP ^7.4|^8.0

Since Oct 13Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/reizucodes/laravel-repository)[ Packagist](https://packagist.org/packages/blaisebueno/laravel-repository)[ RSS](/packages/blaisebueno-laravel-repository/feed)WikiDiscussions master Synced 4mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

Laravel Domain Toolkit
======================

[](#laravel-domain-toolkit)

A Laravel toolkit that scaffolds a layered architecture using repositories, services, DTOs, and domain-oriented generators.
It helps enforce separation of concerns and promotes scalable, testable application design.

---

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

[](#requirements)

- PHP 8.1 or higher
- Laravel 9, 10, 11, 12 and 13

---

Compatibility
-------------

[](#compatibility)

This package supports:

- Laravel 9.x
- Laravel 10.x
- Laravel 11.x
- Laravel 12.x
- Laravel 13.x (Experimental)

---

Supporting Links
----------------

[](#supporting-links)

> Resources related to repository patterns, service layers, and domain-oriented design.

### Architecture &amp; Domain Design

[](#architecture--domain-design)

-
-
-

### Laravel Foundations

[](#laravel-foundations)

-
-
-

---

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

[](#installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

```
composer require reizucodes/laravel-domain-toolkit
```

---

### Step 2: Register the Service Provider (If Needed)

[](#step-2-register-the-service-provider-if-needed)

Laravel supports package auto-discovery, so this step is usually unnecessary.

If auto-discovery is disabled, manually register the service provider:

#### Laravel 10 and Below

[](#laravel-10-and-below)

Add to `config/app.php`:

```
'providers' => [
    BlaiseBueno\LaravelDomainToolkit\DomainToolkitServiceProvider::class,
],
```

#### Laravel 11 and Above

[](#laravel-11-and-above)

Add to `bootstrap/providers.php`:

```
return [
    BlaiseBueno\LaravelDomainToolkit\DomainToolkitServiceProvider::class,
];
```

---

### Step 3: Publish Toolkit Resources

[](#step-3-publish-toolkit-resources)

```
php artisan vendor:publish --tag=laravel-domain-toolkit
```

This will publish:

```
app/Repositories/BaseRepository.php
app/Repositories/Interfaces/EloquentInterface.php
app/Providers/RepositoryServiceProvider.php

stubs/domain-toolkit/
├── repository.stub
├── repository-interface.stub
├── service.stub
└── dto.stub

```

Publishing installs required base classes and stub templates used by the generators.

The published stubs allow you to customize how repositories, services, and DTOs are generated.

You must publish the toolkit before using the generators.

Use `--force` to overwrite existing files:

```
php artisan vendor:publish --tag=laravel-domain-toolkit --force
```

---

Repository Bindings
-------------------

[](#repository-bindings)

Repository bindings are handled through:

```
app/Providers/RepositoryServiceProvider.php

```

### Laravel 11 and Above

[](#laravel-11-and-above-1)

No manual registration is required.
Laravel automatically loads providers inside the `app/Providers` directory.

### Laravel 10 and Below

[](#laravel-10-and-below-1)

Register the provider in `config/app.php`:

```
App\Providers\RepositoryServiceProvider::class,
```

---

Smart Class Resolution
----------------------

[](#smart-class-resolution)

If your application defines:

- App\\Support\\ServiceReturn

The toolkit will automatically use your existing implementation.
Otherwise, it falls back to the package default.

---

Commands
--------

[](#commands)

All commands are registered automatically via the package.
No manual registration is required.

---

Service Return
--------------

[](#service-return)

The toolkit provides a `ServiceReturn` helper to standardize responses from the service layer.

It encapsulates:

- data
- errors
- HTTP status codes

Example:

```
return ServiceReturn::success($data);

return ServiceReturn::clientError('Invalid input');
```

You can convert responses to JSON:

```
return $serviceReturn->toJsonResponse();
```

If your application defines:

```
App\Support\ServiceReturn

```

it will be used when generating services via `make:service` instead of the package default.

---

Usage
=====

[](#usage)

The toolkit provides generators for common architecture components.

---

Generate a Repository
---------------------

[](#generate-a-repository)

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

Creates:

```
app/Repositories/UserRepository.php
app/Repositories/Interfaces/UserInterface.php

```

Also registers the binding in:

```
app/Providers/RepositoryServiceProvider.php

```

---

Generate a Service
------------------

[](#generate-a-service)

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

Creates:

```
app/Services/UserService.php

```

---

Generate a DTO
--------------

[](#generate-a-dto)

```
php artisan make:dto User
```

Creates:

```
app/DTO/UserDto.php

```

---

### Nested DTOs (Recommended)

[](#nested-dtos-recommended)

You can generate DTOs inside folders using slash notation:

```
php artisan make:dto Auth/User
```

Creates:

```
app/DTO/Auth/UserDto.php

```

Namespace:

```
App\DTO\Auth\UserDto
```

---

### DTO Naming Rules

[](#dto-naming-rules)

The generator automatically:

- Converts names to StudlyCase
- Ensures a single `Dto` suffix
- Prevents duplicate suffixes

Examples:

InputOutput`User``UserDto``UserDto``UserDto``user_dto``UserDto``Auth/UserDTO``Auth/UserDto`---

### Notes

[](#notes)

- Nested paths (`Auth/User`) are the standard way to define folders
- Folder structure is automatically reflected in the namespace
- Existing files will prompt for overwrite unless `--force` is used

---

Generate a Full Domain Scaffold
-------------------------------

[](#generate-a-full-domain-scaffold)

```
php artisan make:domain User
```

Creates:

```
app/Models/User.php
app/Http/Controllers/UserController.php
app/Repositories/UserRepository.php
app/Repositories/Interfaces/UserInterface.php
app/Services/UserService.php

```

This command orchestrates the generators and sets up a complete domain layer.

---

Stub Customization
------------------

[](#stub-customization)

All generator templates are published to:

```
stubs/domain-toolkit/

```

You may modify these files to customize generated classes.

---

License
-------

[](#license)

This package is open-source and available under the MIT license.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance59

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

124d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/92848228?v=4)[John Blaise Bueno](/maintainers/reizucodes)[@reizucodes](https://github.com/reizucodes)

---

Top Contributors

[![reizucodes](https://avatars.githubusercontent.com/u/92848228?v=4)](https://github.com/reizucodes "reizucodes (34 commits)")

---

Tags

phplaravelrepository patternrepositorydesign patternservice layerData Abstraction

### Embed Badge

![Health badge](/badges/blaisebueno-laravel-repository/health.svg)

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

###  Alternatives

[torann/laravel-repository

Base repository implementation for Laravel

89508.4k2](/packages/torann-laravel-repository)[awes-io/repository

Implementation of repository pattern for Laravel. The package allows out-of-the-box filtering of data based on parameters in the &lt;b&gt;request&lt;/b&gt;, and also allows you to quickly integrate the list filters and custom criteria.

171105.4k5](/packages/awes-io-repository)[crcms/repository

Detached model and controller warehouse data provider

674.4k5](/packages/crcms-repository)[larachimp/mango-repo

Simple repository package for Laravel 5.

317.2k](/packages/larachimp-mango-repo)[okaybueno/laravel-repositories

A package that provides a neat implementation to integrate the Repository pattern in Laravel with Eloquent.

1816.1k](/packages/okaybueno-laravel-repositories)[salehhashemi/laravel-repository

Implementing the repository pattern for Laravel projects.

2010.5k](/packages/salehhashemi-laravel-repository)

PHPackages © 2026

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