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

Easy Rest Bundle Laravel Package

osm/easy-rest-bundle

OSM EasyRestBundle is a Symfony bundle that streamlines REST API development by turning Doctrine entities into JSON endpoints. It offers automatic CRUD routing, pagination, filtering, and serialization with minimal configuration for consistent, maintainable APIs.

View on GitHub
Deep Wiki
Context7

Getting Started

Confirm the framework boundary first. Despite being requested in a Laravel context, osm/easy-rest-bundle is a Symfony bundle. There is no adapter, no service provider, and no bridge — the bundle hooks into Symfony's HttpKernel, DI container, router, and event dispatcher. As a Laravel developer you cannot composer require this into an app and get working endpoints. So "getting started" splits into two realistic paths:

Path A — You are a Laravel developer (the default case): treat it as a reference, not a dependency. Spend an hour reading the source and borrow ideas; do not add it to composer.json.

  • Read in this order: DependencyInjection/Configuration.php (the config tree), DependencyInjection/OSMEasyRestExtension.php (service wiring), Controller/ (the base controller + response helpers), then Resources/config/routing.yml and Resources/config/services.yml.
  • Translate what you find into Laravel-native equivalents: response envelopes → API Resources, action conventions → single-action controllers or spatie/laravel-route-attributes, content negotiation → middleware, error shaping → a base ApiController / exception handler renderer.

Path B — You actually have a Symfony runtime. Then and only then:

  1. Audit composer.json before anything else — the Symfony constraint likely pins 2.x/3.x. On Symfony 5+ expect to fork and patch.
  2. Register the bundle: AppKernel::registerBundles() (Symfony ≤3) or config/bundles.php (Symfony 4+).
  3. Import the bundle's routing into config/routes.yaml.
  4. Build one read-only endpoint first (GET /api/things/{id}), confirm envelope shape, status codes, and content type, then expand. This surfaces version/serializer incompatibilities cheaply.
  5. Verify: bin/console debug:router | grep -i api and bin/console debug:container.

First real use case either way: a throwaway/prototype endpoint where you want a consistent JSON envelope and RESTful verb mapping without hand-writing it. Nothing beyond that clears the bar — 9 stars, 0 dependents, and a 0.105 health score mean production use is a fork-on-day-one commitment.

Implementation Patterns

Treat it as a routing + response-format layer, never as your domain layer. Keep validation, authorization, persistence, and business rules in your own code (in Symfony: Doctrine repositories, Form types, Voters; in Laravel: Form Requests, Policies, Eloquent). This is what keeps the bundle replaceable when it inevitably stalls.

Laravel translation table if you're porting ideas. The bundle's value is a set of HTTP conventions; map them onto first-party Laravel features rather than reimplementing a mini-framework:

EasyRestBundle concept Laravel-native equivalent
Convention-based REST routing Route::apiResource() / spatie/laravel-route-attributes
JSON response helpers / envelope JsonResource + ResourceCollection, or a base ApiController
Consistent error handling Handler::render() overrides / abort() with typed exceptions
Content negotiation Accept middleware + response()->json()
DI wiring Service container auto-resolution + explicit bindings

One controller per resource; verbs as methods. Whether the bundle uses getAction/postAction conventions or explicit routes, keep the mapping obvious and stable:

Verb Path Responsibility
GET /api/things paginated collection read
GET /api/things/{id} single read
POST /api/things create
PUT/PATCH /api/things/{id} update
DELETE /api/things/{id} delete

Decide serialization once, centrally. If you're on Symfony, pick either JMS Serializer or the Symfony Serializer and commit — mixing @Groups/@ExclusionPolicy across controllers is the fastest way to inconsistent payloads. If you're porting to Laravel, that "decide once" job is exactly the JsonResource / ResourceCollection contract — put the decision in a base resource, not in every endpoint.

Subclass or decorate, don't fork the world. Where the bundle provides a base controller or service, extend it and keep your per-resource classes thin. If you later fork-and-patch, the change footprint is one file. For services you can't live with, use Symfony's decoration (decorates: in services.yaml) instead of editing vendor code.

Version your API from the start. The bundle gives you routing and formatting but essentially nothing around versioning, auth, pagination contracts, or rate limiting — those are on you. If you're going to grow the API, establish /v1/ prefixes and a deprecation policy up front, because retrofitting them into convention-generated routes is painful.

Wrap it in tests at the HTTP boundary. Because the upstream has no visible test suite, write request-level tests (Symfony WebTestCase / Laravel assertJson feature tests) against the behavior you depend on — the envelope shape, status codes, and error format. These tests are your migration harness if you later swap the bundle out.

Gotchas and Tips

The framework mismatch is the dominant gotcha. Any attempt to make this run in Laravel means reimplementing Symfony's kernel contract — a second runtime. Do not do it. If the underlying logic is useful, vendor/reimplement it under MIT with your own tests, scoped as a timeboxed spike.

Check the Composer constraints before writing a single line. This bundle's vintage almost certainly pins outdated symfony/* and PHP versions. Run composer why-not osm/easy-rest-bundle / inspect transitive dependencies on your baseline. A failure here ends the evaluation — don't sink a day into a spike before this check.

Silent breakage on upgrades. Loose or stale constraints plus no release cadence means PHP/Composer/Symfony minor bumps can break the bundle without a clear error. Pin exact versions if you ever adopt, and treat any dependency upgrade as requiring an explicit smoke test of your bundle-backed endpoints.

No security boundary — anywhere. The bundle advertises REST scaffolding, not auth, authorization, or input validation. Do not assume an endpoint is protected because it's routed. Put auth (Sanctum/Passport or Symfony Security) and validation (Form Requests or Symfony Validator) explicitly in front of every route you expose.

There is no upstream support channel. Zero dependents, one maintainer, no advisory process. Any defect or CVE becomes yours. If you adopt it in production, document the fork point, the patches you've applied, and the owner — because the bus factor is one and there is no fallback.

Debugging route/convention magic. When a route "doesn't exist," it's almost always that the bundle's routing resource was never imported into config/routes.yaml. Confirm with debug:router. When a controller isn't resolving, debug:container against the controller tag tells you whether the service was registered — convention-based bundles frequently register services lazily or with non-obvious IDs.

Config lives in the extension, not the docs. The complete set of osm_easy_rest: keys is defined in DependencyInjection/Configuration.php; the actual effect of each key is in OSMEasyRestExtension.php. Read both before tweaking YAML — undocumented keys silently do nothing.

Extension points are the DI container and the event dispatcher. To change behavior without forking: override service definitions in your app's services.yaml, decorate the response/serialization services, and hook kernel.event_listener / kernel.response for cross-cutting concerns. That's the supported seam — anything deeper means you own a fork.

Response-shape drift. With no tests upstream, envelope and content-type behavior can differ between endpoints written at different times. Pin the contract in your own feature tests and centralize where the envelope is produced so every endpoint flows through the same code.

Adoption bar rubric — apply it to this package and future ones. Concrete disqualifiers here: 9 stars, 0 dependents, 0.105 health score, single maintainer, no CI/security policy, wrong framework for a Laravel stack. If a maintainable, framework-native equivalent exists (API Platform for Symfony, API Resources + Sanctum + throttling for Laravel), it clears the bar and this bundle does not. Record the rejection so this evaluation isn't repeated.

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