andersao/l5-repository
61.3
Adequate · 19 September 2026
6.4k
lines of production code
PHP
primary language
1
measurement over time
What this system is
This system is a PHP library that provides a structured repository pattern for managing data access, featuring a refactored interface layer with caching, presentation, and criteria support. It includes a comprehensive code generation suite that scaffolds controllers, migrations, validators, and transformers via Artisan commands. The library integrates with Laravel and Lumen, offering event-driven cache invalidation and Fractal-based JSON serialization for API responses.
How it got here
2015 — Version 2.0 API overhaul and generator expansion
24 changes.
The project underwent a major structural refactoring for version 2.0, introducing new interfaces for caching, presentation, and criteria while replacing the legacy repository implementation with a modern Eloquent-based BaseRepository. This period also focused on expanding developer productivity by adding a comprehensive suite of Artisan commands and stubs for generating controllers, migrations, transformers, and presenters. Concurrently, the codebase was upgraded to support Laravel 8–13 and PHP 8.2+, integrating Fractal for JSON serialization and event-driven cache management.
2016–2026 — Generator stubs and localization expansion
8 changes.
This period focused on enhancing the code generation capabilities by adding stub templates for validators, RESTful controllers, and criteria classes. It also expanded internationalization support by introducing Simplified and Traditional Chinese translations for error messages and package requirements.
Features
Add Chinese language support
Added Chinese (cn) localization files for error messages, including criteria validation errors and required package dependencies.
src/resources/lang/cn · high confidence
Add Traditional Chinese (zh\_TW) localization files
Added new Traditional Chinese language files for the 'criteria' and 'packages' modules. Users will now see specific error messages in Traditional Chinese, such as notifications that certain fields do not support search functionality and instructions to install required Composer packages (prettus/laravel-validation and league/fractal) when dependencies are missing.
_src/resources/lang/zh\TW · high confidence
Added Dutch (nl) localization files for criteria and package requirements
New Dutch translation files have been added to the application's resource directory. Specifically, \src/resources/lang/nl/criteria.php\ provides the error message for unaccepted search fields, and \src/resources/lang/nl/packages.php\ displays installation instructions for required dependencies like \prettus/laravel-validation\ and \league/fractal\ when they are missing. This enables Dutch-speaking users to see localized error and requirement messages.
src/resources/lang/nl · high confidence
Added Italian translations for validation and criteria messages
Users can now see error messages in Italian when validation fails or when required packages are missing. Specifically, the system now displays Italian text for the 'fields\_not\_accepted' criteria message and for requirements regarding the prettus/laravel-validation and league/fractal packages.
src/resources/lang/it · high confidence
Added Romanian (ro) localization files
Introduced Romanian language support by adding new translation files for criteria validation messages and required package dependencies. Users can now see error messages regarding unaccepted search fields and missing validation or fractal packages in Romanian.
src/resources/lang/ro · high confidence
Added cache cleaning listener for repository events
A new CleanCacheRepository listener has been added to automatically clear cached data when repository actions occur. This listener hooks into repository events and, based on configuration settings (repository.cache.clean.enabled and repository.cache.clean.on.{action}), iterates through cached keys associated with the repository and removes them using the cache facade. If an error occurs during this process, it is logged via the Log facade.
src/Prettus/Repository/Listeners · high confidence
Added migration stubs for creating and changing database tables
The repository generator now includes new stub files for generating Laravel database migrations. Users can now generate stubs for creating new tables (including an auto-incrementing ID and timestamps) and for altering existing tables, with placeholders for fields and table names to be populated during generation.
src/Prettus/Repository/Generators/Stubs/migration · high confidence
Added presenter stub template for code generation
A new stub file for generating presenter classes has been added to the generator templates. This stub defines a base presenter class that extends FractalPresenter and implements the getTransformer method to return the associated transformer class, enabling users to generate properly structured presenters for their models.
src/Prettus/Repository/Generators/Stubs/presenter · high confidence
Added stub for generating Criteria classes
A new stub file has been added to the generator templates, enabling users to scaffold new Criteria classes that implement the CriteriaInterface. This stub provides the basic structure for a criteria class, including the required apply method signature, allowing developers to quickly generate the boilerplate code needed for custom query filtering logic.
src/Prettus/Repository/Generators/Stubs/criteria · high confidence
Added stub templates for generating Models and Database Seeders
The repository generator now includes new stub files for creating Eloquent Models and Database Seeders. The Model stub generates classes that extend Laravel's Model and implement the Transformable interface, while the Seeder stub provides a base class for database seeding with model unguarding enabled.
src/Prettus/Repository/Generators/Stubs · high confidence
Added transformer stub for code generation
A new stub file has been added to the generator templates, enabling the automatic creation of Fractal transformer classes. This stub provides a base implementation extending League\\Fractal\\TransformerAbstract, including placeholders for the model namespace, class name, and basic property mapping (id, created\_at, updated\_at), which users can customize when generating transformers via the repository's command-line tools.
src/Prettus/Repository/Generators/Stubs/transformer · high confidence
Added validator stub template for generated classes
A new stub file (validator.stub) has been added to the generator templates, providing a base class structure for generated validators. This template extends LaravelValidator and defines protected $rules arrays for both create and update operations, allowing the code generator to produce validator classes with standard validation rule placeholders.
src/Prettus/Repository/Generators/Stubs/validator · high confidence
Introduce Fractal-based JSON presentation layer
The repository package now includes a new presentation system built on the League\\Fractal library. A new abstract \FractalPresenter\ class handles the transformation of Eloquent models, collections, and paginators into JSON structures, supporting configurable serializers and resource keys. Additionally, a concrete \ModelFractalPresenter\ is provided as a ready-to-use implementation that automatically applies the \ModelTransformer\. This change shifts the default presentation mechanism to leverage Fractal's capabilities for data serialization.
src/Prettus/Repository/Presenter · high confidence
New Eloquent repository and interface stubs for code generation
The repository generator now includes dedicated stub files for creating Eloquent-based repositories. The new \eloquent.stub\ defines a repository class that extends \BaseRepository\, implements the repository interface, and automatically pushes the \RequestCriteria\ during boot. The \interface.stub\ provides the corresponding interface definition extending \RepositoryInterface\. These stubs are used by the generator command to scaffold new repository classes with the correct structure and dependencies.
src/Prettus/Repository/Generators/Stubs/repository · high confidence
New artisan commands for generating repository artifacts
The generator package now provides a suite of new Artisan commands to scaffold repository-related classes, including \make:repository\, \make:entity\, \make:bindings\, \make:resource\ (aliased as \make:rest-controller\ in Laravel 5.5+), \make:presenter\, \make:criteria\, \make:transformer\, and \make:validator\. These commands allow users to quickly generate models, migrations, interfaces, service provider bindings, and validation rules, with options to skip migrations or models and force file overwrites.
src/Prettus/Repository/Generators/Commands · high confidence
New code generators for controllers, migrations, and service bindings
The \src/Prettus/Repository/Generators\ directory now includes a comprehensive set of new generator classes that allow users to scaffold additional application components alongside repositories. \ControllerGenerator\ creates RESTful controllers, \MigrationGenerator\ (supported by \NameParser\, \SchemaParser\, and \RulesParser\) generates database migrations from schema definitions, and \BindingsGenerator\ automatically registers repository interfaces and implementations in the service provider. These additions expand the library's code-generation capabilities beyond basic repository and model creation.
src/Prettus/Repository/Generators · high confidence
New repository lifecycle event classes added
The repository layer now exposes specific event classes for each stage of an entity's lifecycle: creating, created, updating, updated, deleting, and deleted. These classes extend a new \RepositoryEventBase\ and allow listeners to hook into both the pre-action (creating/updating/deleting) and post-action (created/updated/deleted) phases, providing access to the repository instance, the affected model, and the specific action being performed.
src/Prettus/Repository/Events · high confidence
New repository traits for caching, version comparison, presentation, and transformation
This change introduces four new traits to the repository layer: CacheableRepository, which provides methods to manage cache repositories, skip caching, and serialize criteria (including handling closure serialization for Laravel 13+); ComparesVersionsTrait, which adds a version comparison function capable of parsing Lumen version strings; PresentableTrait, which allows setting a presenter and retrieving specific data keys from the presented output; and TransformableTrait, which provides a transform method that converts repository data to an array.
src/Prettus/Repository/Traits · high confidence
New stub for generating RESTful resource controllers
A new controller stub has been added to the generator templates, enabling the creation of full RESTful resource controllers. This generated code includes standard CRUD methods (index, store, show, edit, update, destroy) with integrated validation via Prettus Validator, support for both JSON and view-based responses, and proper dependency injection for repository and validator instances.
src/Prettus/Repository/Generators/Stubs/controller · high confidence
Removals
Removal of Prettus Repository Criteria configuration file
The \src/config/repository-criteria.php\ configuration file has been removed from the project. This file previously defined settings for the Prettus Repository package, including accepted query conditions (such as \=\ and \like\) and request parameter mappings for search, filtering, and ordering. Its removal indicates that the application no longer relies on this specific configuration for repository criteria handling.
src/config · high confidence
Removed English and Portuguese-Brazil criteria translation files
The language files for English (en) and Portuguese-Brazil (pt-br) containing the 'criteria' translations have been deleted. Users will no longer see the specific error message regarding columns not being accepted in research queries from these language packs, as the source files defining these strings have been removed from the codebase.
src/lang · high confidence
Behavioural changes
Add Simplified Chinese translations for criteria and package requirements
Users can now see error messages in Simplified Chinese. Specifically, the 'criteria' module displays a localized message when a field does not support search functionality, and package requirement errors for 'prettus/laravel-validation' and 'league/fractal' are now presented in Simplified Chinese.
_src/resources/lang/zh\CN · high confidence
Added validation error messages for unsupported fields and missing dependencies
The application now displays specific error messages when users attempt to use unsupported columns in research queries (e.g., 'Columns :field are not accepted in the research') and when required packages like \prettus/laravel-validation\ or \league/fractal\ are missing. These localized messages are available in English, Portuguese, and Brazilian Portuguese to guide users on how to resolve the issues.
src/resources/lang/en, src/resources/lang/pt, src/resources/lang/pt-br · high confidence
Enhanced search criteria with relation support, new operators, and configurable join logic
The RequestCriteria now supports searching across related models via dot-notation fields (e.g., 'relation.field'), enabling queries on associated data. It introduces new filter operators 'in' and 'between' for more complex value matching, and adds a 'searchJoin' parameter that allows users to force 'AND' logic between search fields instead of the default 'OR'. Additionally, the criteria now supports eager loading relationships ('with') and counting related models ('withCount') directly through request parameters.
src/Prettus/Repository/Criteria · high confidence
New event-driven cache clearing and Lumen support via dedicated service providers
The library now includes an EventServiceProvider that automatically listens for repository entity creation, update, and deletion events to trigger the CleanCacheRepository listener, ensuring cached data is invalidated when repository data changes. Additionally, a new LumenRepositoryServiceProvider has been added to register generator commands and the event service provider specifically for Lumen applications, while the main RepositoryServiceProvider registers the full suite of generator commands (Repository, Transformer, Presenter, Entity, Validator, Controller, Bindings, Criteria) and handles configuration publishing and translation loading.
src/Prettus/Repository/Providers · high confidence
New repository configuration file with caching and criteria settings
A new \src/resources/config/repository.php\ configuration file has been added, defining default settings for the Prettus Repository package. This includes pagination limits, Fractal serializer options, and a comprehensive cache configuration section that allows users to enable/disable caching, set expiration times, configure cache clearing listeners on CRUD operations, and define which repository methods are cacheable. Additionally, it specifies accepted query conditions (such as \=\, \like\, \in\) and request parameters for filtering queries via Criteria.
src/resources/config · high confidence
Repository contracts refactored for version 2.0 with new caching, presentation, and criteria interfaces
The repository layer has been restructured for version 2.0, introducing new interfaces for caching (CacheableInterface), data presentation (Presentable, PresenterInterface), and model transformation (Transformable, ModelTransformer). The core RepositoryInterface has been expanded with new query methods including findWhereIn, findWhereNotIn, findWhereBetween, syncWithoutDetaching, updateOrCreate, and orderBy, while the old Repository interface was removed. Criteria handling was split into a dedicated RepositoryCriteriaInterface with resetCriteria support, and the CriteriaInterface was renamed and updated to use RepositoryInterface. These changes provide a more modular and feature-rich API for repository implementations.
src/Prettus/Repository/Contracts · high confidence
Repository layer refactored to Eloquent BaseRepository with new caching infrastructure
The repository implementation has been replaced with a new \BaseRepository\ class in the \Eloquent\ namespace, introducing features such as presenter and validator integration, criteria management, and scope handling. This change removes the legacy \Repository\ class and the \RepositoryServiceProvider\, while adding a new \CacheKeys\ helper to manage cache key persistence via a JSON file in the storage framework directory.
src/Prettus/Repository/Eloquent · high confidence
Test coverage
Added comprehensive test suite for repository, caching, and criteria features; Removed legacy PHPUnit 4-style tests for Repository and Criteria.
Dependencies
Upgrade to Laravel 8–13 and PHP 8.2+ support
The package now requires PHP 8.2 or higher and supports Laravel versions 8 through 13, replacing the previous support for older Laravel 5.x releases. This update aligns the \illuminate/\*\ dependencies (http, config, support, database, pagination, console, filesystem, validation, container, contracts) to the ^8.0–^13.0 ranges, updates the test suite to use PHPUnit 11/12 and Orchestra Testbench 9–11, and migrates the autoloading to PSR-4. Users on older PHP or Laravel versions will need to upgrade their environment to install this version.
(dependencies) · high confidence
Vendoring the Prettus Laravel Validation library
The \prettus/laravel-validation\ package has been inlined into the project under \src/Prettus/Validator\. This change introduces the core validation components—\AbstractValidator\, \LaravelValidator\, \ValidatorInterface\, and \ValidatorException\—directly into the codebase, removing the external dependency and allowing the application to use these validation classes without relying on the Composer package.
src/Prettus/Validator · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 61.
Lenses
- Code Health 93
- Architecture 66
- Maturity 54
- Readiness 59
- Security 87
Changes since last survey
- 300 commits — 238 feature/other, 62 fixes
By area
- src/Prettus — 120 commits
- (repo) — 100 commits
- (root) — 67 commits
- src/resources — 6 commits
- .github/workflows — 1 commit
- docs/superpowers — 1 commit
- tests/CacheableRepositoryRoundTripTest.php — 1 commit
- tests/CacheableRepositoryUnitTest.php — 1 commit
- tests/Fixtures — 1 commit
- tests/RepositoryServiceProviderTest.php — 1 commit
- tests/RequestCriteriaIntegrationTest.php — 1 commit
Notable commits
- fix: #424 Fixes validation error when attribute is marked as hidden & fillable
- fix: Ambiguous column fix
- fix: BUGFIX: If an array $attributes exists in the model, its data is written to the table when the repository is updated (#751)
- fix: Binding command fix for #187
- fix: Bindings command update & fix for #185
- fix: Bug fix
- fix: Bug fix, fix that validation error messages don't display correctly
- fix: Fix BaseRepository::sync() (prevent "[BadMethodCallException] Method sync does not exist" exception)
- fix: Fix Laravel 5.1 addVisible does not chain $this
- fix: Fix broken Markdown headings
- fix: Fix class conversion to string error
- fix: Fix criteria cache for PHP 7.4 compatibility (#705)
- fix: Fix option force on make:resource command in 5.5
- fix: Fix paginate() declaration to match parent for PHP 7.2
- fix: Fix php8.4 nullable
- fix: Fix problems method deleteWhere
- fix: Fix sync, added aplyscope findWhereIn and findWhereNotInt
- fix: Fix syntax error of markdown
- fix: Fix table name convention for migration when making a entity.
- fix: Fix: ValidatorGenerator not being executed
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
andersao/l5-repository was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 1a296887db2ec0b1f83c5a0a04ed40a192af8c4c — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.