PHPackages                             nauxa-labs/laravel-repository-service - 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. nauxa-labs/laravel-repository-service

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

nauxa-labs/laravel-repository-service
=====================================

A flexible Repository and Service pattern implementation for Laravel applications

v2.1.0(5mo ago)00MITPHPPHP ^8.1CI passing

Since Dec 11Pushed 5mo agoCompare

[ Source](https://github.com/nauxa-labs/laravel-repository-service)[ Packagist](https://packagist.org/packages/nauxa-labs/laravel-repository-service)[ RSS](/packages/nauxa-labs-laravel-repository-service/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (6)Used By (0)

Laravel Repository Service
==========================

[](#laravel-repository-service)

[![Tests](https://github.com/nauxa-labs/laravel-repository-service/actions/workflows/tests.yml/badge.svg)](https://github.com/nauxa-labs/laravel-repository-service/actions/workflows/tests.yml)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![PHP Version](https://camo.githubusercontent.com/ef363a5a30025ffef1857918c40fa01e97f03929e5f87d12a14bf334a7de9220/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d3838393242462e737667)](https://www.php.net)[![Laravel Version](https://camo.githubusercontent.com/93b9e6f22c88d9977835720b074861d7e09b90972216a02224b86c6930ebf282/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31302e7825323025374325323031312e782d4646324432302e737667)](https://laravel.com)

A flexible Repository and Service pattern implementation for Laravel applications.

✨ Features
----------

[](#-features)

- 🎯 **Flexible Service Pattern**: `ServiceContract` and `BaseService` are intentionally empty, allowing you to define methods with any signature
- 📦 **Standard Repository Pattern**: `RepositoryContract` and `EloquentRepository` provide standard CRUD operations
- 🚀 **Artisan Commands**: Generate repositories and services with `make:repository` and `make:service`
- 🔍 **Enhanced Query Methods**: `findWhere()`, `findWhereIn()`, `paginate()`, `with()`, `firstOrCreate()`
- ⚡ **Laravel Integration**: Auto-discovery support via Service Provider
- ✅ **Fully Tested**: Comprehensive test suite with PHPUnit

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

[](#requirements)

- PHP ^8.1
- Laravel ^10.0 or ^11.0

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

[](#installation)

```
composer require nauxa-labs/laravel-repository-service
```

The package will be auto-discovered by Laravel. No additional configuration needed.

Quick Start
-----------

[](#quick-start)

### Generate a Repository

[](#generate-a-repository)

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

This creates:

- `app/Repositories/UserRepository.php` (interface)
- `app/Repositories/UserRepositoryImplement.php` (implementation)

### Generate a Service

[](#generate-a-service)

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

This creates:

- `app/Services/UserService.php` (interface)
- `app/Services/UserServiceImplement.php` (implementation)

Usage
-----

[](#usage)

### Creating a Service

[](#creating-a-service)

```
