PHPackages                             manowartop/repository-service-laravel-pattern - 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. [Framework](/categories/framework)
4. /
5. manowartop/repository-service-laravel-pattern

ActiveLibrary[Framework](/categories/framework)

manowartop/repository-service-laravel-pattern
=============================================

Structure for the Laravel Service-Repository Pattern

v1.8(2y ago)85263[1 issues](https://github.com/manowartop97/repository-service-laravel-pattern/issues)1MITPHPPHP &gt;=7.2

Since Oct 27Pushed 2y ago1 watchersCompare

[ Source](https://github.com/manowartop97/repository-service-laravel-pattern)[ Packagist](https://packagist.org/packages/manowartop/repository-service-laravel-pattern)[ RSS](/packages/manowartop-repository-service-laravel-pattern/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (10)Used By (1)

Laravel Service-Repository Pattern package
==========================================

[](#laravel-service-repository-pattern-package)

This package provides base repository and service for your Laravel Service-Repository pattern:

- Adds a repository layer, so you can avoid using your models directly and do all the calls via repository
- Adds a service layer which supports CRUD and search functionality

Usage
=====

[](#usage)

- Create model (f.e Post)
- Create a repository `PostRepository extends Manowartop\BaseRepositoryAndService\Repositories\BaseRepository`
- Define property `protected $modelClass = Post::class;` in PostRepository
- Create a service `PostService extends Manowartop\BaseRepositoryAndService\Services\BaseCrudService`
- Define property in `protected $repository = PostRepository::class;` in `PostService`

That`s all. Now you have access to the next set of methods:

Repository methods
------------------

[](#repository-methods)

### CRUD

[](#crud)

- `getModel(): Model` - get the model of current repository
- `create(array $data): ?Model` - creates a new model
- `createMany(array $data): Illuminate\Support\Collection` - create many models from an array
- `update($keyOrModel, array $data): ?Model` - update model by PK or model instance
- `updateOrCreate(array $attributes, array $data): ?Model` - update or create model
- `delete($keyOrModel): bool` - delete model by PK or instance
- `deleteMany(array $keysOrModels): void` - delete many (array of PK or models)

### Query

[](#query)

- `find($key): ?Model` - find model by PK
- `findOrFail($value, ?string $column = null): Model` - find or fail by PK
- `getAll(array $search = []): Collection` - search a collection of models
- `getAllPaginated(array $search = [], int $pageSize = 15): LengthAwarePaginator` - search for paginated models collection
- `findMany(array $attributes): Collection` - find all models by params
- `findFirst(array $attributes): ?Model` - find first model by params
- `with(array $with): BaseRepositoryInterface` - set param `$with` to specify relations to query models with
- `withCount(array $withCount): BaseRepositoryInterface` - set param `$withCount` to specify relations\_count to query models with

If you need to specify query filtering - just override `protected function getFilteredQuery(array $search = []): Builder` in you repository

Service methods
---------------

[](#service-methods)

- `getAllPaginated(array $search = [], int $pageSize = 15): LengthAwarePaginator` - search for paginated models collection
- `getAll(array $search = []): Collection` - search a collection of models
- `findOrFail($value, ?string $column = null): Model` - find or fail by PK
- `create(array $data): ?Model` - creates a new model
- `createMany(array $data): Illuminate\Support\Collection` - create many models from an array
- `update($keyOrModel, array $data): ?Model` - update model by PK or model instance
- `updateOrCreate(array $attributes, array $data): ?Model` - update or create model
- `delete($keyOrModel): bool` - delete model by PK or instance
- `deleteMany(array $keysOrModels): void` - delete many (array of PK or models)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

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 ~127 days

Recently: every ~161 days

Total

9

Last Release

1005d ago

### Community

Maintainers

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

---

Top Contributors

[![manowartop97](https://avatars.githubusercontent.com/u/30038912?v=4)](https://github.com/manowartop97 "manowartop97 (9 commits)")

---

Tags

laravelservicerepositorybase-servicebase repositoryservice and repository

### Embed Badge

![Health badge](/badges/manowartop-repository-service-laravel-pattern/health.svg)

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

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k49.4M479](/packages/laravel-scout)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[laravel/pennant

A simple, lightweight library for managing feature flags.

57311.1M53](/packages/laravel-pennant)[laravel/cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

264778.4k3](/packages/laravel-cashier-paddle)

PHPackages © 2026

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