Version 1.5.2 is a patch release focused on making the package safe to install and closing two data-exposure defects. There are no new features.
The Auditable trait previously recorded every attribute verbatim. Applying it to a model holding credentials, such as User, wrote password hashes and tokens into model_audits in readable form.
Passwords, tokens, and secrets are now excluded by default, on both the old and new value sides. The list is configurable through lara-util-x.audit.excluded_attributes, and a model can add its own by overriding auditExcludedAttributes().
See the Auditable trait documentation for details.
The abstract CrudController passed ?sort_by straight to orderBy(), so a caller could order results by any column on the table, including ones they could not read, and infer values from the row order.
Sorting now requires the column to appear in $sortableFields:
class PostController extends CrudController
{
protected array $sortableFields = ['title', 'created_at'];
}
A value outside the list is ignored rather than rejected. When the list is empty, no sorting is applied.
This covers the abstract base class. Controllers produced by make:crud still apply ?sort_by without restriction, so add an allow-list to generated controllers whose tables hold sensitive columns.
composer.json previously declared no dependencies at all, not even a php constraint, so Composer would install the package into any project and let it fail later at runtime. It now declares them properly:
| Requirement | Constraint |
|---|---|
| PHP | ^8.1 |
| Laravel | ^10.0 \| ^11.0 \| ^12.0 \| ^13.0 |
| Carbon | ^2.67 \| ^3.0 |
| Guzzle | ^7.0 |
minimum-stability: dev was also removed, since it pushed dev-stability resolution onto every consumer.
The previously documented support range of Laravel 8.0+ and PHP 8.0+ was never accurate. RejectCommonPasswords implements Illuminate\Contracts\Validation\ValidationRule, which exists only in Laravel 10 and later, and the LLM response objects use readonly properties, which require PHP 8.1.
| Issue | Fix |
|---|---|
deleteRecord() returned a JSON body with a 204 No Content status, which is not a valid combination |
Returns 200 with the message body |
MakeCrudCommandTest leaked generated files between tests, causing a failure on roughly a quarter of random-order runs |
Generated files are removed in setUp as well as tearDown |
The audit table name was hardcoded to model_audits |
Configurable via lara-util-x.audit.table |
Two behaviour changes may affect existing code:
CrudController by an arbitrary column, declare those columns in $sortableFields.deleteRecord() returns 200 instead of 204. Clients that special-cased the empty-body status need updating.If you adopted Auditable before this release, existing rows still hold whatever was captured at the time. This release changes what is written going forward but does not rewrite history, so review and purge any sensitive values already stored.
The suite grew from 162 to 175 tests, with new coverage for CrudController and the Auditable trait.
It was verified against every supported version:
| Laravel | PHPUnit | Result |
|---|---|---|
| 10.50.3 | 10.5.64 | 175 passed |
| 11.56.0 | 12.5.33 | 175 passed |
| 12.67.0 | 12.5.33 | 175 passed |
| 13.26.1 | 12.5.33 | 175 passed |
cd packages/omarchouman/lara-util-x
./vendor/bin/phpunit
| Path | Status |
|---|---|
CHANGELOG.md |
Added |
tests/Unit/Traits/AuditableTest.php |
Added |
tests/Feature/Http/Controllers/CrudControllerTest.php |
Added |
composer.json |
Modified, declares dependencies, drops dev stability |
config/lara-util-x.php |
Modified, adds the audit block |
src/Traits/Auditable.php |
Modified, excludes sensitive attributes, configurable table |
src/Http/Controllers/CrudController.php |
Modified, $sortableFields, delete returns 200 |
tests/Unit/Console/MakeCrudCommandTest.php |
Modified, cleans generated files between tests |
Readme.md |
Modified, corrected support range, documents make:crud and XHelper |