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

ActiveLibrary

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 1mo ago

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 49% 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

4255d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8e0db56af4c5a3b576666ebbae05020bf14cba21d5a3048737d60927cbb4dce?d=identicon)[koalabs](/maintainers/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

[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)[glhd/linen

21135.6k](/packages/glhd-linen)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

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