jooservices/laravel-repository

Base repositories with CRUD, filtering, ordering and query-from-request for Laravel

Maintainers

Package info

github.com/jooservices/laravel-repository

pkg:composer/jooservices/laravel-repository

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-03-09 02:07 UTC

This package is auto-updated.

Last update: 2026-04-07 07:19:44 UTC


README

The JOOservices Laravel Repository package is a PHP 8.5+ Laravel package for trait-based repository composition, CRUD support, filter and order pipelines, and request-driven query assembly.

Package name: jooservices/laravel-repository

Install

composer require jooservices/laravel-repository

Optionally publish the package config:

php artisan vendor:publish --tag=laravel-repository-config

Quick example

use App\Models\User;
use Jooservices\LaravelRepository\Contracts\RepositoryInterface;
use Jooservices\LaravelRepository\Repositories\EloquentRepository;
use Jooservices\LaravelRepository\Traits\HasCrud;
use Jooservices\LaravelRepository\Traits\HasFilter;
use Jooservices\LaravelRepository\Traits\HasOrder;

final class UserRepository extends EloquentRepository implements RepositoryInterface
{
    use HasCrud;
    use HasFilter;
    use HasOrder;

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

$repository = app(UserRepository::class);
$user = $repository->find($id);
$users = $repository->filter(['status' => 'active'])->orderBy(['created_at' => 'desc'])->paginate(15);

What is supported today

  • trait-based repository composition through segregated contracts and traits
  • CRUD operations through HasCrud
  • filter chains, collection retrieval, and pagination through HasFilter
  • ordering through HasOrder
  • request-driven query parsing through HasRequestQuery
  • reusable Filter and Order value objects

Important current boundaries

  • repositories opt into behavior through traits; no feature is globally implied
  • query state is lazily created and reset after terminal filter operations
  • RequestQueryParser supports only the implemented clause families

Documentation

Start with:

AI Support

This repository includes an AI skill pack for agents working in Cursor, Claude Code, VS Code, JetBrains, and Antigravity.

Start with:

The canonical skill source lives in .github/skills/, with adapter layers for each supported AI environment.

Development

composer lint:all
composer test

Contributor workflow details live in:

GitHub Actions and Services

The repository workflow set is designed to include CI, release, PR labeler, semantic PR title, scorecard, and secret-scanning workflows.

The CI baseline covers security checks, linting, tests with coverage artifacts, and optional dependency review. Release is tag-driven through vX.Y.Z tags.

Current external service integrations:

  • Codecov for CI coverage uploads when CODECOV_TOKEN is configured
  • Packagist for release-time package update notifications

Changelog

See CHANGELOG.md for version history.

License

This project is licensed under the MIT License.