PHPackages                             mtkh73/repo-handler - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mtkh73/repo-handler

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mtkh73/repo-handler
===================

optimize and make rewritable your project with the repository pattern

v1.2.0(6y ago)317MITPHPPHP ^7.1.3|7.2.\*|7.3.\*|7.4.\*CI failing

Since Jan 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/matin-kh73/RepositoryPattern)[ Packagist](https://packagist.org/packages/mtkh73/repo-handler)[ RSS](/packages/mtkh73-repo-handler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

[![Build Status](https://camo.githubusercontent.com/c59043e0b28eab034f19dabc49c9222c43e3fbe5e0c6bc2837a5c0086132a211/68747470733a2f2f7472617669732d63692e6f72672f6c61726176656c2f6672616d65776f726b2e737667)](https://travis-ci.org/matin-kh73/RepositoryPattern.svg?branch=master)[![Total Downloads](https://camo.githubusercontent.com/f086d9a7174e187fde99feb0d7ae663fb0171523d98f062efbe38bd0f3987810/68747470733a2f2f706f7365722e707567782e6f72672f6d746b6837332f7265706f2d68616e646c65722f646f776e6c6f616473)](https://packagist.org/packages/mtkh73/repo-handler)[![Latest Stable Version](https://camo.githubusercontent.com/0d7c3f08d0e0e594995e40c92081b9fdd0308272c54ce77e959c1dee0fef4cdb/68747470733a2f2f706f7365722e707567782e6f72672f6d746b6837332f7265706f2d68616e646c65722f762f737461626c65)](https://packagist.org/packages/mtkh73/repo-handler)[![](https://camo.githubusercontent.com/1fecd3b004a1eca4d30e570451d369426a061d9590fc1c4cef525b462bba1a71/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6174696e2d6b6837332f5265706f7369746f72795061747465726e2f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://packagist.org/packages/laravel/framework)[![License](https://camo.githubusercontent.com/2246a20997b6406d5c73ccc40f006c364017edb850b1d126ddfbfe841eee6946/68747470733a2f2f706f7365722e707567782e6f72672f6d746b6837332f7265706f2d68616e646c65722f6c6963656e7365)](https://packagist.org/packages/mtkh73/repo-handler)

About RepositoryPattern
-----------------------

[](#about-repositorypattern)

The Repository Pattern is one of the most popular patterns to create an enterprise level application. It restricts us to work directly with the data in the application and creates new layers for database operations, business logic, and the application’s UI. using the Repository Pattern has many advantages:

- Your business logic can be unit tested without data access logic;
- The database access code can be reused;
- Your database access code is centrally managed so easy to implement any database access policies, like caching;
- It’s easy to implement domain logic;
- Your domain entities or business entities are strongly typed with annotations; and more.

How to work with this package
-----------------------------

[](#how-to-work-with-this-package)

`php artisan make:repository ModelName`

After installing this package, a command will be added on your artisan command with  **make:repository**  name. with this command you can create a repository class for your model classes.

After running this command if the model exists, a directory called Repository creates in your app directory.to use your repository class you can inject it in any controller that you want. after that you can easily use all of the features in your repository class.

etc
---

[](#etc)

`php artisan make:repository Models\User`

[![](https://user-images.githubusercontent.com/38176879/77259649-947cde80-6ca0-11ea-82ad-004d28aab6de.png)](https://user-images.githubusercontent.com/38176879/77259649-947cde80-6ca0-11ea-82ad-004d28aab6de.png)

In this example, you can see a method with setFilters name!

you can apply your any eloquent filters on your query.but where is these filters??

 You can create your filters with this command: `php artisan make:filter With'`

After creating the filter, the structure of this class like this :

[![](https://user-images.githubusercontent.com/38176879/77259667-bf673280-6ca0-11ea-9b47-8e6a2e655c8e.png)](https://user-images.githubusercontent.com/38176879/77259667-bf673280-6ca0-11ea-9b47-8e6a2e655c8e.png)

The implementation of your filter must be in the handle method! the args variable includes the value that you set on the setFilters method!

**Be careful after creating the filters, you have to set filters on the repository config file.**

In the repositories directory, there are 4 things!

- a BaseRepository class that is the parent of all repositories that you created in your project and includes and contains a number of functions that can be the same in your repository classes.
- a BaseRepositoryInterface class
- a RepositoryServiceProvider for binding your repository classes to the interface that previously made.
- and finally, a directory with your model name that includes a repository class is created and a directory with contracts name.

**Be careful If you want using your repository class with their contracts you have to bind them together on the RepositoryServiceProvider class!**

[![](https://user-images.githubusercontent.com/38176879/77549316-50225600-6ecd-11ea-803f-0ac896bc4cc3.png)](https://user-images.githubusercontent.com/38176879/77549316-50225600-6ecd-11ea-803f-0ac896bc4cc3.png)

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

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

Total

2

Last Release

2199d ago

PHP version history (2 changes)1.0.0PHP ^7.1.3

v1.2.0PHP ^7.1.3|7.2.\*|7.3.\*|7.4.\*

### Community

Maintainers

![](https://www.gravatar.com/avatar/0392312520390a2ef833a44e0b43f6d39bb4990d7a48b4aab0bc024b100a02ea?d=identicon)[matin-kh73](/maintainers/matin-kh73)

---

Top Contributors

[![matin-kh73](https://avatars.githubusercontent.com/u/38176879?v=4)](https://github.com/matin-kh73 "matin-kh73 (9 commits)")

---

Tags

phplaravelrepositorypattern

### Embed Badge

![Health badge](/badges/mtkh73-repo-handler/health.svg)

```
[![Health](https://phpackages.com/badges/mtkh73-repo-handler/health.svg)](https://phpackages.com/packages/mtkh73-repo-handler)
```

###  Alternatives

[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[salmanzafar/laravel-geocode

A Laravel Library to find Lat and Long of a given Specific Address

153.9k](/packages/salmanzafar-laravel-geocode)

PHPackages © 2026

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