ronasit/laravel-helpers
A collection of handy Laravel helper functions and utilities for common development tasks, including array and string helpers, model conveniences, and other time-saving tools. Lightweight, easy to install, and simple to integrate into any Laravel project.
composer require ronasit/laravel-helpers. The package is Laravel-auto-discovered; no manual provider registration is normally required. If you keep a config/app.php providers list, check composer.json → extra.laravel.providers for the exact provider name.src/ tree, especially Traits/, Exceptions/, and any Commands/ directory. The README covers the high-level feature list, but the traits are where most day-to-day value lives.bootstrap/app.php (Laravel 11+) or app/Exceptions/Handler.php (Laravel 10 and below).RonasIT\Support\Exceptions\* that relate to entity generation/handling. They are now deprecated in favour of the EntityGenerator package. Existing catches still work in 3.8.x, but plan the import move before the next major.composer show ronasit/laravel-helpers and php artisan about after install to confirm the version and that no provider/config conflicts were introduced.Response standardisation
Use the package response traits in an abstract ApiController so every controller inherits the same envelope:
abstract class ApiController extends Controller
{
use JsonResponseTrait; // or the response trait exposed by your installed version
}
This keeps status codes, payload wrapping, and error shapes consistent without repeating response()->json(...) in every action.
Exception → HTTP mapping
Register renderers once, rather than catching in controllers:
// bootstrap/app.php (Laravel 11+)
->withExceptions(function (Exceptions $exceptions) {
$exceptions->render(function (ResourceNotFoundException $e) {
return response()->json(['message' => $e->getMessage()], 404);
});
})
For Laravel 10, the equivalent belongs in app/Exceptions/Handler.php::register(). This is the main integration point for the package's exception classes.
Model search / filtering traits
Apply the package model traits to Eloquent models to get query-string-driven search, ordering, and pagination:
class Order extends Model
{
use ModelTrait;
}
Treat these traits as a starting point rather than a security boundary — validate or whitelist searchable/sortable columns at the controller or form-request layer, because the traits commonly read directly from the request.
Entity/CRUD services
Where the package provides service, repository, or entity-control traits, the common workflow is: thin controller → service method → repository/model trait. Keep business rules in the service, and let the package handle repetitive lookup/CRUD plumbing. If you are also using RonasIT/laravel-entity-generator, prefer the generator's classes and exceptions as the primary source and use laravel-helpers for the generic HTTP/response plumbing.
Deprecation migration pattern (3.8.3)
For any deprecated exception currently imported from this package, either:
use statement to the EntityGenerator namespace and add laravel-entity-generator as a direct dependency, orDo not rely on catching the deprecated class by FQCN if you expect the package to drop it in a major release.
Testing
Assert against the standardised envelope rather than raw JSON, e.g. assertJsonStructure, assertStatus, and assertJsonPath('message', ...). If your tests catch specific exception classes, they will need the same import update as production code.
convertDeprecationsToExceptions, PHPUnit deprecation reporting, PHPStan baseline). Suppress or fix the imports rather than ignoring them.response, search, index, or similar, PHP will fatal on the collision. Alias with use TraitA { method as traitMethod; } or refactor the conflicting method.$this->get('/endpoint?search=...') or bind a request instance; avoid calling trait methods directly without a request context.php artisan config:clear after edits. Stale cached config is the usual cause of "it worked locally" surprises.bootstrap/app.php. Copying examples written for Laravel 10's Handler.php into an 11+ app silently does nothing.^3.8 and treat the eventual removal as a breaking upgrade. Check the changelog for the major release that drops them before upgrading.app/Support namespace over editing vendor code; publishable config and container bindings are the intended override mechanisms where offered.vendor/ronasit/laravel-helpers/src/ — the README often lags behind the code, and the 3.8.x line has been refactoring classes out to companion packages.How can I help you explore Laravel packages today?