PHPackages                             thecoderepublic/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. thecoderepublic/repository

ActiveLibrary

thecoderepublic/repository
==========================

v1.01(1y ago)15241MITPHP

Since Dec 7Pushed 1y ago3 watchersCompare

[ Source](https://github.com/thecoderepublic/repository)[ Packagist](https://packagist.org/packages/thecoderepublic/repository)[ RSS](/packages/thecoderepublic-repository/feed)WikiDiscussions master Synced 1w ago

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

#### Laravel Repository and Service Class

[](#laravel-repository-and-service-class)

##### Repository

[](#repository)

A simplified method to have all Eloquent Queries isolated in other classes than Eloquent in order to prevent code duplication or easily add caching.

Without a classical Repository implementation, this is just a new layer class over Eloquent.

##### Service

[](#service)

A different layer to put the bussiness logic in. Following the pattern: request -&gt; controller -&gt; call service -&gt; get data from repository -&gt; apply some logic -&gt; return -&gt; response

#### Added Interfaces for Model

[](#added-interfaces-for-model)

The repository will implement an interface for the model, so you can easily switch the model in the repository.

#### Installation

[](#installation)

`composer require thecoderepublic/repository`

In `config/app.php` at 'providers' add:

`TheCodeRepublic\Repository\RepositoryServiceProvider::class,`

#### Usage

[](#usage)

`php artisan make:repo {modelName}`

This creates a new repo in app/Repositories Ex: `php artisan make:repo Product` will create `app/Repositories/ProductRepository.php`

in constructor of `ProductRepository.php` the model will be setup to use `App\Models\Product` and `$this->model = $model` `$model` being the instance of Product.

`php artisan make:service {serviceName}`

This creates a new service in app/Services ex: `php artisan make:repo ProductSearch` will create `app/Service/ProductSearchService.php`

`php artisan make:logic {modelName}`This creates a new service in app/Services and a new repo in app/Repositories Ex: `php artisan make:logic Product` will create `app/Repositories/ProductRepository.php` , `app/Services/ProductService.php` and `app/Interface/ProductInterface.php`

in the constructor of 'ProductSearchService.php` you can inject all the repositories you need in order to perform the business logic you want.

`ProductSearchService` can be injected in methods of a controller, command or other service.

```
use App\Service\ProductSearchService
```

```
public function doSomeStuff($productSearchService ProductSearchService)
{
    $this->productSearchService = $productSearchService;
    $this->productSearchService->someMethodFromService($par1,$par2)
}
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.9% 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 ~663 days

Total

2

Last Release

592d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3153a0e4cc96f823f7e3db459e3d13beb10903350420daf6e3d6d5c50c25a03?d=identicon)[thecoderepublic](/maintainers/thecoderepublic)

---

Top Contributors

[![franciscboicu-cmyk](https://avatars.githubusercontent.com/u/259962261?v=4)](https://github.com/franciscboicu-cmyk "franciscboicu-cmyk (18 commits)")[![IonutRusen](https://avatars.githubusercontent.com/u/15908431?v=4)](https://github.com/IonutRusen "IonutRusen (16 commits)")

---

Tags

laravellaravel-packagerepository-patternscaffoldingservice-pattern

### Embed Badge

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

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

PHPackages © 2026

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