PHPackages                             kelcampus/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. kelcampus/laravel-repository

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

kelcampus/laravel-repository
============================

Cópia do pacote Artesãos Warehouse Tag 3.0.0 ajustado para o Laravel 10

1.10.0(2y ago)01.2k↓100%MITPHPPHP ^8.1

Since Aug 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/kelcampus/laravel-repository)[ Packagist](https://packagist.org/packages/kelcampus/laravel-repository)[ RSS](/packages/kelcampus-laravel-repository/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (7)Versions (7)Used By (0)

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

[](#laravel-repository)

Cópia do pacote

Ajustado para funcionar com Laravel 7, Laravel 8, Laravel 9.

Como usar
---------

[](#como-usar)

Retirado de

Warehouse v2 é um pacote base, ele implementa o básico sem nenhuma regra de negócio definida. Há duas classes base: `BaseRepository` e `AbstractCrudRepository`

### BaseRepository

[](#baserepository)

Esta classe implementa o contrato `BaseRepository`, que possui três assinaturas:

```
 /**
  * Returns all records.
  * If $take is false then brings all records
  * If $paginate is true returns Paginator instance.
  *
  * @param int  $take
  * @param bool $paginate
  *
  * @return EloquentCollection|Paginator
  */
  public function getAll($take = 15, $paginate = true);
```

```
/**
 * Retrieves a record by his id
 * If $fail is true fires ModelNotFoundException. When no record is found.
 *
 * @param int     $id
 * @param bool $fail
 *
 * @return Model
 */
 public function findByID($id, $fail = true);
```

```
/**
 * @param string $column
 * @param string|null $key
 *
 * @return \Illuminate\Support\Collection|array
 */
public function lists($column, $key = null);
```

Já na implementação, `BaseRepository` disponibiliza dois métodos protegidos `newQuery()` e `doQuery($query = null, $take = 15, $paginate = true)`. Eles são amplamente usados nos repositórios.

#### newQuery

[](#newquery)

*newQuery* retorna um objeto [QueryBuilder](https://github.com/laravel/framework/blob/7.x/src/Illuminate/Database/Eloquent/Builder.php) do eloquent, à partir da propriedade `modelClass`.

```
protected function newQuery()
{
    return app()->make($this->modelClass)->newQuery();
}
```

> Essa propriedade precisa ser definida em todos as classes repositório

#### doQuery

[](#doquery)

*doQuery* processa a query e retorna uma collection ou um objeto paginate, dependendo dos parametros passados

```
protected function doQuery($query = null, $take = 15, $paginate = true)
{
    if (is_null($query)) {
        $query = $this->newQuery();
    }

    if (true == $paginate):
        return $query->paginate($take);
    endif;

    if ($take > 0 || false != $take) {
        $query->take($take);
    }

    return $query->get();
}
```

###  Health Score

31

—

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Recently: every ~264 days

Total

6

Last Release

986d ago

Major Versions

0.1.0 → 1.0.02022-03-03

PHP version history (4 changes)0.0.1PHP ^7.2

0.1.0PHP ^7.2|^8.0

1.0.0PHP ^8.0

1.10.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/489c87535003942410e8c4a1a7ac3586c3f61b9cb215b1d64c467b409ad4b3bd?d=identicon)[kelcampus](/maintainers/kelcampus)

---

Top Contributors

[![kelcampus](https://avatars.githubusercontent.com/u/5183044?v=4)](https://github.com/kelcampus "kelcampus (9 commits)")

---

Tags

laravelmodeleloquentrepositorylaravel10

### Embed Badge

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

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

###  Alternatives

[prettus/l5-repository

Laravel 5|6|7|8|9|10|11|12 - Repositories to the database layer

4.3k10.6M131](/packages/prettus-l5-repository)

PHPackages © 2026

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