PHPackages                             koalabs/repo - 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. koalabs/repo

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

koalabs/repo
============

Simple implementation of the Repository Interface for Eloquent with the most basic CRUD methods

v1.0.0(11y ago)1221MITPHPPHP &gt;=5.4.0

Since Sep 22Pushed 11y ago1 watchersCompare

[ Source](https://github.com/koalabs-lab/laravel-repo)[ Packagist](https://packagist.org/packages/koalabs/repo)[ RSS](/packages/koalabs-repo/feed)WikiDiscussions master Synced today

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

Laravel Repo
============

[](#laravel-repo)

Simple implementation of the Repository Interface for Eloquent with the most basic CRUD methods.

If you find yourself implementing the same default methods over an over again for every new repository class you create, this package could save you some time.

Quick overview
--------------

[](#quick-overview)

Repo consists of two basic files:

- RepoInterface.php (Interface)
- Repo.php
- CacheableRepo.php

### Repo.php

[](#repophp)

The *Repo.php* file is just an interface with the basic CRUD methods (Create, Read, Update, Destroy). It will enforce you implement all methods should you choose to use some other kind of Repository in the future.

### EloquentRepo.php

[](#eloquentrepophp)

The *EloquentRepo.php* file is an Eloquent implementation of the Repo interface. Keep reading to find out how I intend to use it.

Install
-------

[](#install)

In your application's root directory, open up the *composer.json* file and add the package to the `require` section so it looks like this:

```
"require": {
    "koalabs/repo": "dev-master"
},
```

Open the command line, and in the root ot our application, run the Composer update like this:

```
php composer.phar update

```

Now let's add the Repo Service Provider. Open the *app/config/app.php* file and in the `providers` array, add the following line:

```
'Koalabs\Repo\RepoServiceProvider'
```

Usage
-----

[](#usage)

You have at your disposal a simple repository class that handles eloquent entities (models). Every new repository you create will simply be an extension of the *EloquenRepository*. Here is an example:

```
use Koalabs\Repo\Repo;

class UserRepository extends Repo {

    protected $relations = ['role'];

    public function __construct(User $entity)
    {
        parent::__construct($entity);
    }
}
```

The only thing you have to do for the child repository class is tell the repository which Eloquent model/entity (in this case, User) it should manage. You'll then be able to use default methods for finding, creating, storing, and deleting the specified model. With that you should be good to go, but dive into the package's code for a better grasp at what's happening under the hoods.

### Available methods

[](#available-methods)

You'll have these basic CRUD methods at your disposal:

- `findById($id)`
- `findByField($field, $value)`
- `all($orderBy)`
- `create(array $fields)`
- `update($id, array $fields)`
- `destroy($id)`

Cacheable Repos
---------------

[](#cacheable-repos)

There's the added option to use a basic *filesystem* cache with your repos. Simply extend the `CacheableRepo` class instead of the `Repo` and you'll be good to go.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

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

Unknown

Total

1

Last Release

4302d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5720262?v=4)[koalabs](/maintainers/koalabs)[@KoaLabs](https://github.com/KoaLabs)

---

Top Contributors

[![crloscstillo](https://avatars.githubusercontent.com/u/1431847?v=4)](https://github.com/crloscstillo "crloscstillo (8 commits)")

---

Tags

laravel

### Embed Badge

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

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

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M11.6k](/packages/illuminate-database)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[lemaur/eloquent-publishing

218.1k1](/packages/lemaur-eloquent-publishing)

PHPackages © 2026

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