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 Bundle Laravel Package

somnambulist/api-bundle

Somnambulist API Bundle provides a lightweight, opinionated foundation for building JSON APIs in Laravel, with conventions for responses, errors, versioning, and middleware to help standardize endpoints and speed development.

View on GitHub
Deep Wiki
Context7

Helpers for working with Fractal and Symfony and converting exceptions to JSON

Frequently asked questions about Api Bundle
Is somnambulist/api-bundle a Laravel package or a Symfony bundle?
It is a Symfony bundle, not a Laravel package. It integrates with Symfony's dependency-injection container, HTTP kernel, event dispatcher, and routing layer. Laravel uses its own kernel, container, and routing stack, so the package does not plug in natively.
Can I use somnambulist/api-bundle in a Laravel application?
You can add it via Composer, but the architecture fit is poor. Adopting it in Laravel means bridging Symfony-style service wiring into Laravel's service provider model or running Symfony components inside Laravel. That produces a fragile hybrid that is hard to debug and maintain. For a Laravel-first codebase, prefer Laravel-native packages or a small in-house implementation.
How do I install and register somnambulist/api-bundle?
In a Symfony application, install it with Composer and register the bundle in your Symfony kernel or bundles configuration. It then wires into Symfony's container and HTTP kernel. There is no native Laravel service provider installation path; using it in Laravel requires custom bridging and is not recommended.
What features does somnambulist/api-bundle provide for JSON APIs?
It provides helpers for building JSON APIs with League Fractal, including transformer-based serialization, a consistent JSON error contract for exceptions, pagination helpers, and API documentation conventions. It is intentionally lightweight and opinionated. Exact response envelopes and features should be verified against the current README and source.
Does somnambulist/api-bundle work with Fractal transformers?
Yes, it is built around league/fractal for transformation and serialization. It pulls Fractal in as a transitive dependency, so you also inherit Fractal's own maintenance and upgrade considerations. Check compatibility with your Fractal version before adopting.
Which Symfony and PHP versions does somnambulist/api-bundle support?
The provided context does not state exact version constraints. As a Symfony bundle, it must track Symfony majors such as symfony/http-kernel and symfony/framework-bundle plus supported PHP versions. Review composer.json and test against the Symfony and PHP versions you plan to run in 18 months.
Is somnambulist/api-bundle actively maintained and safe for production?
There is very little adoption signal: roughly 3 stars and 0 dependents on Packagist at the time of assessment. It is effectively a single-maintainer project with no vendor support agreement and a bus factor of one. No published security advisories is not proof of safety; low-adoption dependencies receive less scrutiny. Treat abandonment and version lock-step as real production risks.
What are Laravel alternatives to somnambulist/api-bundle for JSON error responses?
Laravel already provides an exception handler, API resources, and response macros that cover many JSON error and response needs. Problem-details style errors, pagination envelopes, and versioned routing can be implemented with well-adopted Laravel packages or roughly 200 lines of in-house code. Avoid importing a Symfony bundle just to get these conventions.
How does somnambulist/api-bundle handle exception-to-JSON conversion and error responses?
The bundle owns exception-to-JSON conversion and a consistent error contract, often problem-details style, so API consumers see standardized error payloads. Because these contracts are the bundle's core surface, even minor-version changes can break clients if formatting shifts. Pin versions and add contract tests around error responses before relying on it.
How should I test somnambulist/api-bundle response and pagination contracts?
Write functional tests against a Symfony test kernel that assert status codes, error JSON shape, pagination envelopes, and serialization output. Because adoption is near zero, you cannot rely on downstream projects to catch regressions, so your own contract tests are essential. Include upgrade tests for Symfony and Fractal version bumps.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections