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

wizards/rest-bundle

A Symfony bundle for quickly building RESTful APIs, with helpers for resource exposure, serialization, pagination, filtering, and consistent JSON responses.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install and pin. composer require wizards/rest-bundle. The last tagged release is January 2021, so check the composer.json constraints against your PHP/Symfony version before committing. On Symfony 5.4+ this usually installs cleanly; on PHP 8.2+ expect deprecation noise and possibly a fork.
  2. Register the bundle in config/bundles.php (Wizards\RestBundle\WizardsRestBundle::class => ['all' => true]) and import its routing. Look at the package's Resources/config/ directory first — that is where the routing file, service definitions, and default configuration live, and it tells you more than the README.
  3. Check the configuration reference. Run bin/console config:dump-reference wizards_rest (or whatever the bundle alias is — confirm in the DI extension class) to see what is actually configurable in your installed version rather than trusting docs written for an older tag.
  4. Inspect the container. bin/console debug:container --tag=... and debug:router are your fastest way to see which generic controllers, listeners, and normalizers the bundle registered. This bundle is largely "wiring plus conventions," so the service graph is the documentation.
  5. First use case: take one existing Doctrine entity and expose it read-only through the bundle's generic controller before touching writes. Confirm the JSON shape, pagination defaults, and error format match what your frontend expects. Only then enable create/update/delete.

A realistic day-one goal is replacing a hand-rolled EntityController with the bundle's generic CRUD for one resource, not migrating your whole API.

Implementation Patterns

  • Entity-per-resource mapping. The core workflow is: configure an entity (annotations, YAML, or attributes depending on version), point a route at the generic controller, and let the bundle handle list/show/create/update/delete. Keep the entity config next to the entity so it is discoverable.
  • Serialization groups. Use Symfony serializer groups to shape output per operation (list vs. detail). This is the main lever for keeping payloads sane; without it you will leak relations and lazy-loading proxies.
  • Filtering, sorting, pagination. Expose query-string parameters through the bundle's filter configuration rather than writing custom query builders. For anything non-trivial (joins, computed fields), add a custom repository method and a thin controller that delegates — do not fight the generic controller.
  • Security at the firewall, not the controller. Put access_control rules on the generated routes and use voters for row-level checks. The generic controllers are hard to decorate per-action, so authorization belongs in Symfony Security.
  • Custom normalizers/transformers for output that does not match the entity 1:1 (enums, money objects, computed URLs). Register them as services and let the serializer chain pick them up.
  • Event subscribers are the practical extension point for cross-cutting concerns (adding headers, auditing writes, translating errors) since you rarely want to subclass the bundle's controllers.
  • Versioning via route prefixes (/api/v1/...) in your routing import, not via bundle config.

Gotchas and Tips

  • Treat it as low-maintenance. One star and no release since early 2021 means no upstream fixes. Pin the exact version, and be prepared to fork or vendor the few classes you depend on. Budget time for a migration path off it if the API is core to your product.
  • PHP 8 / newer Symfony friction. Expect deprecations from older DI patterns, and check for ContainerAwareCommand-era code. Run the test suite and a smoke request against every generated route after any Symfony minor upgrade.
  • Convention over configuration cuts both ways. Route names, parameter names (page, limit, sort), and error envelopes are fixed by the bundle. If your clients expect different shapes, adapt at the gateway/proxy or override the normalizer — do not assume there is a config key for it.
  • Debugging: when a route 404s, check debug:router first — the bundle's routing import is easy to mis-scope. When a response is empty, check serializer groups and whether the entity was actually registered as a resource.
  • Watch lazy loading. Generic list endpoints will happily serialize entire object graphs. Enforce MaxDepth or explicit groups and verify query counts with the profiler before shipping.
  • Error handling is opaque. The bundle's exception-to-response mapping may swallow validation details. Add a listener that logs the original exception so 400s are diagnosable in production.
  • Extension points that are safe: custom normalizers, event subscribers, and your own controllers wrapping the bundle's services. Unsafe: overriding bundle templates/routes in config/, which silently break on upgrade.
  • Document the pinned version and the fork diff in the repo README. With a package this small and stale, the next developer will otherwise spend a day rediscovering what you learned.
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.
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
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
cgv/localized-resource