PHPackages                             vkoori/laravel-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. [Database &amp; ORM](/categories/database)
4. /
5. vkoori/laravel-repository

ActiveLibrary[Database &amp; ORM](/categories/database)

vkoori/laravel-repository
=========================

Base repository for laravel projects

0.2.2(1y ago)04PHP

Since Jul 11Pushed 1y agoCompare

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

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

### Laravel Base Repository

[](#laravel-base-repository)

A clean, reusable Base Repository class for Laravel apps that helps you organize data access logic using DTOs (Data Transfer Objects) and follow best practices like:

- Separation of concerns
- Reusable query logic
- Type-safe input/output
- Easy extension for model-specific behavior

### Installation

[](#installation)

You can install the package via Composer:

```
composer require vkoori/laravel-repository
```

### Usage

[](#usage)

1. create dto based on [this document](https://github.com/vkoori/laravel-model-dto)
2. Create a Model-Specific Repository

```
/**
 * @extends BaseRepository
 */
class UserRepository extends BaseRepository
{
    protected function getModel(): User
    {
        return new User();
    }

    protected function getDTO(): UserDTO
    {
        return new UserDTO();
    }
}
```

3. Use It in Your Code

```
$userRepo = new UserRepository();

// Create
$userDTO = (new UserDTO())->setName('John')->setEmail('john@example.com')->setActive(true);
$user = $userRepo->create($userDTO);

// Get all
$users = $userRepo->get();

// Searching and pagination
$activeDTO = (new UserDTO())->setActive(true);
$user = $userRepo->paginate($activeDTO);

// Find by ID
$user = $userRepo->findById(1);

// Load Relations
$user = $userRepo->findByIdOrFail(1, ['posts']);

// Update
$updateDto = (new UserDTO())->setActive(false);
$user = $userRepo->update(1, $updateDto);

// Delete
$userRepo->deleteById(1);

// Batch insert
$values = [
    (new UserDTO())->setName('Alice')->setEmail('alice@example.com'),
    (new UserDTO())->setName('Bob')->setEmail('bob@example.com'),
];
$userRepo->batchInsert($values);
```

### Available Methods

[](#available-methods)

Here’s a list of all available methods in [BaseRepositoryInterface](src/BaseRepositoryInterface.php)

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance46

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

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

4

Last Release

402d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/87c1574170082a3c779cca97f90846e478dcc46114fc66480fbd04975b71a746?d=identicon)[vkoori](/maintainers/vkoori)

---

Tags

laraveleloquentrepository

### Embed Badge

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

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

###  Alternatives

[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8723.3M27](/packages/yajra-laravel-oci8)[prettus/l5-repository

Laravel 8|9|10|11|12|13 - Repositories to the database layer

4.2k11.5M161](/packages/prettus-l5-repository)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.9M110](/packages/mongodb-laravel-mongodb)[laravel/cashier

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

2.6k31.8M161](/packages/laravel-cashier)[laravel/scout

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

1.7k57.2M683](/packages/laravel-scout)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k35.7M52](/packages/kirschbaum-development-eloquent-power-joins)

PHPackages © 2026

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