PHPackages                             imjonos/laravel-base-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. imjonos/laravel-base-repository

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

imjonos/laravel-base-repository
===============================

Laravel base repository

1.1.3(1mo ago)08251MITPHP

Since Aug 17Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/imjonos/laravel-base-repository)[ Packagist](https://packagist.org/packages/imjonos/laravel-base-repository)[ Docs](https://github.com/imjonos/laravel-base-repository)[ RSS](/packages/imjonos-laravel-base-repository/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (9)Used By (1)

📦 Laravel Base Repository
=========================

[](#-laravel-base-repository)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2257fdd78d554757edc5a3f444613a4312f4f3e42b0b99be40138295992a59b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d6a6f6e6f732f6c61726176656c2d626173652d7265706f7369746f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/imjonos/laravel-base-repository)
[![Total Downloads](https://camo.githubusercontent.com/2588608893dc74ac312e256474146c15d1da8200dbab68bec2ffa82fe5647f62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696d6a6f6e6f732f6c61726176656c2d626173652d7265706f7369746f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/imjonos/laravel-base-repository)

A **generic base repository class** for Laravel projects that provides a clean and consistent way to interact with Eloquent models. It simplifies CRUD operations and makes your code more maintainable, testable, and scalable.

---

🧩 Overview
----------

[](#-overview)

This package provides an abstract `EloquentRepository` class that implements the `EloquentRepositoryInterface`. It wraps common model interactions into reusable methods, making it easier to manage data access logic in your Laravel applications.

---

🛠 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require imjonos/laravel-base-repository
```

---

✅ Usage
-------

[](#-usage)

### 1. Create Your Repository Class

[](#1-create-your-repository-class)

Create a new repository class that extends `EloquentRepository` and specifies the model class:

```
namespace App\Repositories;

use App\Models\Order;
use Nos\BaseRepository\EloquentRepository;

class OrderRepository extends EloquentRepository
{
    protected string $class = Order::class;
}
```

### 2. Use the Repository in a Controller or Service

[](#2-use-the-repository-in-a-controller-or-service)

Inject the repository and use its methods:

```
namespace App\Http\Controllers;

use App\Repositories\OrderRepository;
use Illuminate\Http\Request;

class OrderController extends Controller
{
    protected $repository;

    public function __construct(OrderRepository $repository)
    {
        $this->repository = $repository;
    }

    public function index()
    {
        $orders = $this->repository->all();
        return view('orders.index', compact('orders'));
    }

    public function store(Request $request)
    {
        $order = $this->repository->create($request->all());
        return redirect()->route('orders.show', $order->id);
    }
}
```

---

🔧 Available Methods
-------------------

[](#-available-methods)

MethodDescription`all()`Get all records`count()`Count all records`create(array $data)`Create a new record`update(int $id, array $data)`Update a record by ID`exists(int $id)`Check if a record exists`find(int $id)`Find a record by ID (throws exception if not found)`delete(int $id)`Delete a record by ID`query()`Return a query builder instance for custom queries---

🌐 Project Structure
-------------------

[](#-project-structure)

```
vendor/
└── imjonos/
    └── laravel-base-repository/
        ├── src/
        │   └── EloquentRepository.php
        └── interfaces/
            └── EloquentRepositoryInterface.php

```

---

📦 Requirements
--------------

[](#-requirements)

- PHP 8.0+
- Laravel 9+

---

🧪 Testing
---------

[](#-testing)

You can easily mock the repository interface in your tests, which helps keep your application logic decoupled from the database and improves test coverage.

---

🚀 Contributing
--------------

[](#-contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

---

📝 License
---------

[](#-license)

This package is open-sourced software licensed under the MIT license. Please see the [license file](license.md) for more information.

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance90

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

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

Recently: every ~270 days

Total

7

Last Release

49d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a691ecb149ac661add3a6229e3c545aaaa40bad4ae0fa9c0ad9464c79e86ff20?d=identicon)[Eugeny Nosenko](/maintainers/Eugeny%20Nosenko)

---

Top Contributors

[![imjonos](https://avatars.githubusercontent.com/u/5132976?v=4)](https://github.com/imjonos "imjonos (14 commits)")

---

Tags

laravelrepository

### Embed Badge

![Health badge](/badges/imjonos-laravel-base-repository/health.svg)

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

###  Alternatives

[cybercog/laravel-paket

Composer personal web interface. Manage Laravel dependencies without switching to command line!

1753.3k](/packages/cybercog-laravel-paket)[amin3520/anar

:description

272.3k](/packages/amin3520-anar)[mckenziearts/laravel-command

A simple Laravel package to provide artisan new commands

321.2k](/packages/mckenziearts-laravel-command)

PHPackages © 2026

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