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

Rest Bundle Laravel Package

ntarakan/rest-bundle

A lightweight REST bundle for Laravel/PHP that provides conventions and helpers for building RESTful APIs. It aims to reduce boilerplate around routing, controllers, and JSON responses so CRUD endpoints stay consistent and easier to maintain.

View on GitHub
Deep Wiki
Context7

Getting Started

This bundle is effectively unmaintained (1 star, no dependents), so treat "getting started" as an audit exercise as much as an install.

  1. Inspect before installing. Clone the repo and read composer.json first — check the declared Symfony version constraint, PHP requirement, and whether autoload.psr-4 points at a real src/ namespace. If the constraint is pinned to something like ^3.4|^4.0, it will not resolve on a modern Symfony app without --ignore-platform-reqs, which is a red flag, not a workaround.
  2. Install into a scratch app, not an existing project:
    composer require ntarakan/rest-bundle
    
  3. Register the bundle manually. There is almost certainly no Flex recipe, so add it to config/bundles.php:
    Ntarakan\RestBundle\RestBundle::class => ['all' => true],
    
    Verify the actual class name and namespace from src/*Bundle.php — do not assume.
  4. Locate the entry points. Open the bundle class and look for getContainerExtension(), load(), and any Resources/config/services.yaml (or .xml). That tells you what services, listeners, and routing loaders the bundle actually injects. If the extension is empty, the "bundle" is likely just a base controller and some helpers.
  5. Check for routing. Look for Resources/config/routing.xml/.yaml and any @Route annotations in a Controller/ directory. If routes are attribute/annotation-based, enable the bundle's controller path in config/routes.yaml.
  6. First use case: build one trivial endpoint — a GET /ping and a POST /echo that deserializes a JSON body and returns it — extending whatever base controller the bundle ships. If that requires fighting the bundle, stop there and evaluate writing the equivalent in 30 lines of vanilla Symfony instead.

If step 1 or 3 fails, the correct outcome is to not adopt the package.

Implementation Patterns

Because the package is a "simple REST bundle," the realistic day-to-day value is in three places: a base controller, request/response helpers, and (possibly) an exception-to-JSON listener. Patterns worth checking for:

Base controller extension Most bundles of this shape provide an abstract controller with helpers. If present, extend it in your app controllers and use its helpers rather than duplicating new JsonResponse(...) calls:

class OrderController extends AbstractRestController
{
    public function show(int $id): Response
    {
        return $this->respond($this->orders->find($id));
    }
}

Prefer composition (inject a service) over inheritance if the base class has a heavy constructor or hard-coded dependencies.

Request body handling Look for a Request decorator, a ParamConverter, or a listener that maps JSON bodies to DTOs. If the bundle does this, your controllers should accept typed arguments and let the bundle populate them. If it does not, you are better off with symfony/serializer + MapRequestPayload (Symfony 6.3+) and should skip the bundle's request handling entirely.

Response shaping If the bundle normalizes entities to JSON, confirm whether it uses the Serializer component or json_encode on public properties. The latter leaks internal fields and breaks on circular references. Wire symfony/serializer groups explicitly if the bundle lets you.

Error handling A "simple REST bundle" often ships an ExceptionListener or kernel.exception subscriber that converts exceptions to { "error": "..." } with an appropriate status code. Pattern: throw domain exceptions from services, let the listener map them. Verify the status-code mapping table in the listener source — defaults are frequently wrong (e.g. everything becomes 500).

Routing conventions If the bundle exposes a routes resource, import it once and keep app routes separate:

# config/routes/rest_bundle.yaml
rest_bundle:
    resource: '@RestBundle/Resources/config/routing.yaml'

Avoid mixing the bundle's generated routes with hand-written ones in the same prefix — it makes debug:router output hard to reason about.

Testing Treat the bundle as a black box: use WebTestCase and KernelBrowser against your endpoints. Do not unit-test the bundle's internals; you will be pinning yourself to unmaintained code.

Integration tip — wrap, don't scatter. If you adopt the bundle's helpers, put a thin app-level ApiController between your controllers and the bundle's base class. When the bundle inevitably goes stale, you swap one file instead of thirty.

Gotchas and Tips

The real risk is maintenance, not bugs. With 1 star and 0 dependents, no one is filing issues, so you will find the bugs yourself. Before adopting, check the last commit date and the composer.json Symfony constraint. An unreleased-on-Packagist or version-dev-master requirement is a hard no for production.

No Flex recipe. Expect manual bundle registration and manual config file creation. If bin/console config:dump-reference rest returns nothing, the bundle has no Configuration tree — meaning no validated config, and typos in YAML will fail silently rather than loudly.

getContainerExtension() returning null is common in minimalist bundles. If so, there is no rest: config section at all; everything is convention or hard-coded. Check debug:container --tag=kernel.event_subscriber and debug:router to discover what was actually registered.

Autowiring surprises. Old bundles often define services with explicit arguments: referencing service IDs that no longer exist in modern Symfony (e.g. templating, doctrine.orm.entity_manager without a guard). Symptom: container compiles but a service fails at first request. Fix with a compiler pass or by overriding the service definition in your own services.yaml.

Deprecations masquerade as errors. On Symfony 5.4/6.x you may get Method ... has no return type specified deprecations from the bundle that flood logs. Suppress narrowly via deprecation handler config rather than editing vendor code.

Debugging order of operations:

  1. bin/console debug:router — did any routes load?
  2. bin/console debug:container '<bundle namespace>' — did services register?
  3. bin/console lint:container — catches bad service references early.
  4. bin/console about — confirm the bundle appears in the kernel's registered bundles.

Extension points to prefer (in order):

  • Decoration over inheritance — decorate the bundle's serializer/response service in services.yaml so you keep the bundle's wiring but control the output.
  • Event subscribers — if the bundle dispatches custom events (check for EventDispatcherInterface in the source), hook there rather than overriding classes.
  • Config overrides — only if a Configuration tree exists.
  • Avoid editing vendor code; if you need a patch, use cweagans/composer-patches so it survives composer install.

Serializer leaks. If the bundle serializes entities directly, add @Groups and configure the bundle's normalizer only if it delegates to symfony/serializer. If it uses json_encode, wrap every response through your own normalizer — otherwise you will ship relation graphs and internal columns to clients.

Verdict framing for a team: budget a day to prototype one endpoint. If the prototype needs more than trivial glue, the honest recommendation is to implement the same REST helpers yourself on top of symfony/serializer, symfony/validator, and MapRequestPayload. You will get the same ergonomics with active maintenance, and you will not be the only person who has ever debugged this bundle.

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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource