PHPackages                             arafat-web/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. [Framework](/categories/framework)
4. /
5. arafat-web/repository

ActiveLibrary[Framework](/categories/framework)

arafat-web/repository
=====================

simple laravel repository pattern

v1.0.4(1y ago)012MITPHP

Since Sep 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/arafat-web/repository)[ Packagist](https://packagist.org/packages/arafat-web/repository)[ Docs](https://github.com/arafat-web/repository)[ RSS](/packages/arafat-web-repository/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

laravel-repository
==================

[](#laravel-repository)

Simple but powerfull laravel repository pattern

---

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

[](#installation)

```
composer require arafat-web/repository
```

After installing the package you will see a file **repository.php** is created inside **repositories** folder

\##Make a repository

```
php artisan make:repository UserRepository
or
// use scope for specific model
php artisan make:repository UserRepository --model=User
```

How to create function in repository
------------------------------------

[](#how-to-create-function-in-repository)

```
//Create
public static function storeByRequest($request): User
{
    return self::create([
        'first_name' => $request->first_name,
        'last_name' => $request->last_name,
        'email' => $request->email,
        // ...
    ]);
}

// Update
public static function updateByRequest($request, User $user): User
{
    self::update($user, [
        'first_name' => $request->first_name,
        'last_name' => $request->last_name,
        'email' => $request->email,
        // ...
    ]);

    // or

    $user->update([
        // your update data
    ])

    return $user;
}
// etc...
```

Use from controller
-------------------

[](#use-from-controller)

#### Import first the Repository

[](#import-first-the-repository)

```
//example UserRepository
use App\Repositories\UserRepository;
```

```
// get all user
UserRepository::getAll(); //retun all users
// filter user use query
UserRepository::query()->whereName('john')->get();
// store method call
UserRepository::storeByRequest($request);
// update method call
UserRepository::updateByRequest($request, $user);
//find
UserRepository::find($userID);
//get first recode
UserRepository::first();
// delete recode
UserRepository::delete($userID);
```

#### Publish stubs folder

[](#publish-stubs-folder)

```
php artisan vendor:publish --tag=stubs
```

Contribution
------------

[](#contribution)

You're open to create any Pull request.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Total

5

Last Release

602d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/42122f0924fda76f5d5e449974167ddb67596997e8236b5f11380e36f2584f5c?d=identicon)[arafat-web](/maintainers/arafat-web)

---

Top Contributors

[![arafat-web](https://avatars.githubusercontent.com/u/26932301?v=4)](https://github.com/arafat-web "arafat-web (5 commits)")

---

Tags

laravelrepository patternrepositoryarafat

### Embed Badge

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

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

###  Alternatives

[mahabub/laravel-crud-and-repository-generator

laravel crud generator with repository pattern

111.7k](/packages/mahabub-laravel-crud-and-repository-generator)

PHPackages © 2026

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