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
Base Api Bundle

Base Api Bundle Laravel Package

onema/base-api-bundle

A Symfony bundle that provides a reusable foundation for building JSON APIs, including common controllers, response and exception helpers, and API utilities so you can skip repetitive setup and focus on your application's endpoints.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Base Api Bundle
What is onema/base-api-bundle used for?
It provides a reusable foundation for building REST APIs in PHP, with base API controllers, standardized JSON responses, centralized exception handling, and API utilities. It is intended to reduce repetitive setup so you can focus on endpoint logic. The package is described as a Symfony bundle with a PSR-friendly design and minimal dependencies.
How do I install onema/base-api-bundle with Composer?
Install it with Composer using composer require onema/base-api-bundle. In a Symfony application, register the bundle according to its documentation, then extend the provided base controllers. For Laravel projects, verify compatibility first because the package is documented as a Symfony bundle, not a native Laravel package.
Does onema/base-api-bundle work with Laravel?
Not natively; onema/base-api-bundle is a Symfony bundle, so it does not provide Laravel service providers or Laravel-specific HTTP helpers in the excerpt. Its PSR-friendly architecture and minimal dependencies may allow selective reuse, but you would need to adapt response and exception handling to Laravel's request lifecycle. If you need a drop-in Laravel API foundation, evaluate Laravel-native options first.
Which Laravel or Symfony versions does it support?
The provided excerpt does not list specific Laravel or Symfony version constraints. Check the repository's composer.json and release notes for supported PHP and Symfony versions before installing. Because it is a Symfony bundle, Laravel version support is not stated and should be treated as requiring custom integration.
How do I return consistent JSON responses from a base API controller?
Use the bundle's base API controller and its helpers for common response types to keep JSON output uniform. Centralize success and error envelopes in that base layer rather than building ad hoc arrays in each endpoint. This helps keep status codes, payload shape, and error metadata consistent across the API.
How does the bundle handle exceptions and HTTP status codes?
The bundle centralizes exception handling and maps exceptions to HTTP status codes for uniform JSON error responses. Configure the mapping in the bundle so domain exceptions translate into predictable API errors. This keeps transport-level error formatting separate from domain logic.
Can I configure serialization and pagination for API responses?
Yes, the package advertises configurable serialization and pagination support. Use the bundle configuration to define how resources are serialized and how paginated results expose metadata. Confirm the exact configuration keys and response helpers in the repository documentation, since the excerpt does not list them.
How should I test API endpoints built with this bundle?
Test the API at the HTTP layer by asserting status codes, headers, and the standardized JSON structure for success and error cases. In Symfony, use the framework's test client; in an adapted Laravel setup, use Laravel's HTTP test helpers. Because responses are uniform, you can write shared assertions for the common response envelope.
Is onema/base-api-bundle production-ready and actively maintained?
The excerpt does not include maintenance metrics, release cadence, or test coverage, so you should verify those on the repository before adopting it. Review recent commits, open issues, tagged releases, and whether the supported Symfony and PHP versions match your stack. Its minimal dependency footprint and predictable response model are good signs, but production readiness depends on your own compatibility and security review.
What are good alternatives for Laravel API development?
For Laravel, native API resources, route-model binding, and Laravel's exception handler are often the simplest alternatives for consistent JSON APIs. For Symfony, API Platform is a fuller-featured option, while custom base controllers remain a lightweight choice. Compare on required features such as serialization, pagination, error format, and framework integration before choosing.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console