Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Api Rest Utils

Api Rest Utils Laravel Package

everycheck/api-rest-utils

A Symfony utility package offering a JSON response builder with common API statuses and custom headers, plus a paginated repository trait for filtering, ordering, and searching entities across joins.

View on GitHub
Deep Wiki
Context7

Some basic utils we use in every api rest project under symfony

Frequently asked questions about Api Rest Utils
Is everycheck/api-rest-utils a Laravel package?
No. It is explicitly a Symfony utility library for API REST projects, with a ResponseBuilder that returns Symfony\Component\HttpFoundation\Response objects and a Doctrine repository trait. It has no Laravel service provider, facade, config, or Eloquent integration. Laravel teams should treat it as a pattern reference rather than a dependency.
Can I install everycheck/api-rest-utils in a Laravel 10 or 11 application?
You probably can, and you probably should not rely on it. The code is Symfony 2.x/3.x-era and likely pins symfony/http-foundation versions that conflict with the Symfony 6/7 components used by Laravel 10/11, so Composer may fail resolution or force downgrades. The package is also archived with no maintenance, so any install is unsupported from day one.
How do I implement the api-rest-utils ResponseBuilder pattern in Laravel?
Build a small App\Http\ApiResponse class or Response macro that wraps response()->json($payload, $status, $headers). Use a consistent envelope such as data and meta on success, and error with code, message, and details on failure. Map ModelNotFoundException, AuthorizationException, and ValidationException in the exception handler to your notFound, forbidden, and validation error responses. That reproduces the useful part of the package in roughly 150 to 250 lines without importing Symfony or Doctrine coupling.
What response statuses does the everycheck api-rest-utils ResponseBuilder provide?
The README lists json, empty, notFound, ok, created, deleted, conflict, forbiddenRoute, forbiddenAcl, forbidden, badRequest, formError, and unauthorized. The naming is a reasonable API error taxonomy, but the implementation is Symfony-specific and includes Symfony Form error parsing. In Laravel, implement the same vocabulary natively with response()->json and your own error envelope.
Does everycheck/api-rest-utils work with Laravel Eloquent and pagination?
No. Its paginated repository trait is built for Doctrine ORM EntityRepository classes and uses DQL-style joins, filters, and ordering. Laravel's Eloquent uses query scopes, API Resources, and LengthAwarePaginator instead. Porting the trait would mean fighting Doctrine versus Eloquent rather than gaining a useful abstraction.
Is everycheck/api-rest-utils maintained and safe for production?
The assessment describes it as archived with 1 star, 0 dependents, no changelog, no visible test suite, no CI badge, and no contributing guide. That means no upstream maintenance, no security response, and no issue triage; you inherit full ownership immediately. For production Laravel work, that is a high provenance risk regardless of how small the utility code is.
What is the JMS Serializer dependency in api-rest-utils and why does it matter for Laravel?
The ResponseBuilder constructor requires a JMS Serializer instance, which is common in some Symfony stacks but uncommon in Laravel applications. That hard dependency is baked into every response path, making the builder harder to mock, test, and replace with Laravel's native serialization. Laravel teams are better served by API Resources or explicit array transformation before response()->json.
Is the pagination trait in api-rest-utils safe from SQL injection?
That cannot be assumed. The TPM assessment flags unassessed filter and pagination safety because the trait builds filters from request input, with a real possibility of unparameterized DQL or missing allow-listing. Before copying any part of it, review the source for field allow-lists and parameter binding. Do not expose request-driven filters to production without that review.
What Laravel alternatives should I use instead of everycheck/api-rest-utils?
Use response()->json for responses, API Resources for serialization, LengthAwarePaginator for pagination, query scopes for filters and ordering, and Laravel's exception handler for error mapping. A tiny ApiResponse facade or Response macro can provide the ok, created, notFound, and validation error vocabulary without a third-party dependency. This keeps your API contract Laravel-idiomatic and fully under your control.
Can I fork or copy code from everycheck/api-rest-utils into a proprietary Laravel codebase?
Only after confirming the declared license, which the assessment describes as unverifiable and requiring confirmation before any code is copied. The safer path is to reimplement the response vocabulary and pagination behavior from the README as a design reference, not copy the implementation. If you do fork, you own maintenance, testing, security review, and compatibility with modern Symfony and Laravel versions.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource