定制 jooservices/laravel-repository 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jooservices/laravel-repository

Composer 安装命令:

composer require jooservices/laravel-repository

包简介

PHP 8.5+ Laravel repository package for trait-based CRUD, filtering, ordering, and request-driven query composition

README 文档

README

codecov CI OpenSSF Scorecard PHP Version License: MIT Packagist Version

The JOOservices Laravel Repository package is a PHP 8.5+ Laravel package for trait-based repository composition, CRUD, filtering, ordering, and request-driven query composition.

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
  • opt-in request-query allowlists and strict mode through HasAllowedRequestQuery
  • request-driven field selection, named request filters, callback micro filters, request-query aliases, aggregate include helpers, and value-normalization rules
  • first-class request operators such as exact, partial, beginsWith, and endsWith, plus safe aliases like eq, neq, gt, gte, lt, lte, and like
  • opt-in request scopes, scope definitions, relation count clauses, nested relation filters including whereHas and whereDoesntHave variants, derived count or exists includes, additional sum or avg or min or max aggregate includes, and cursor pagination
  • reusable criteria stacks through HasCriteria
  • read terminals such as first, firstOrFail, exists, and count through HasRead
  • chunk, lazy, cursor, and lazyById iteration through HasIteration
  • safe request pagination through paginateFromRequest()
  • opt-in cache wrappers and cache-key helpers through HasCache
  • 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.

统计信息

  • 总下载量: 340
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固