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

Simple Rest Crud Bundle Laravel Package

hessnatur/simple-rest-crud-bundle

A Symfony bundle that adds simple RESTful CRUD capabilities to your application, helping you scaffold create, read, update, and delete endpoints with minimal configuration. Lightweight and straightforward for basic resource management.

View on GitHub
Deep Wiki
Context7

Getting Started

First, the honest framing: this is a Symfony 4 bundle, not a Laravel package. It wires together fos-rest-bundle, jms-serializer, and lexik-form-filter-bundle, none of which have Laravel equivalents that drop in. You cannot composer require this into a Laravel app and get anything useful — there is no service provider, no facade, no config publishing. Treat it as a reference implementation of CRUD plumbing, not a dependency.

If you are evaluating it in a Symfony context (or reading it as a pattern source):

  1. Read the source first, not the README. With 1 star and 0 dependents, the code is the documentation. Look for the abstract controller/service classes and the service definitions in Resources/config/.
  2. Check composer.json for the pinned constraints — Symfony 4.x, FOSRestBundle, JMS Serializer, LexikFormFilterBundle. These versions are effectively frozen; FOSRestBundle itself has been retired.
  3. The intended flow is: a Doctrine entity → an abstract CRUD controller subclass → a Symfony Form type → a filter form type → JSON in/out via JMS serialization groups.
  4. First use case to validate: a single entity with list (filtered + paginated) and show/create/update/delete endpoints. If that path doesn't work cleanly against a current Symfony version, nothing downstream will.

If you are a Laravel developer looking for the equivalent: skip the package and build the four moving parts it represents — an abstract resource controller, FormRequest validation, a query-filter layer, and API Resources for output shaping. That's roughly 200 lines and you own it.

Implementation Patterns

The bundle's value is the separation it enforces. Borrow these patterns regardless of framework:

1. Abstract controller + per-entity subclass. The base controller owns the verbs (index/show/store/update/destroy); the subclass declares the entity class, form type, filter type, and serialization groups. In Laravel this maps cleanly to a base ApiController with abstract model(), storeRequest(), updateRequest(), and resource() methods, plus Route::apiResource.

2. Form/filter objects as the single input boundary. The bundle leans on Symfony Forms for both writes (validation + hydration) and reads (Lexik filter forms applied to a Doctrine QueryBuilder). The Laravel analogue for writes is FormRequest; for reads, a dedicated FilterRequest that whitelists sortable/filterable fields and hands a scoped query to the controller. Never let raw query params reach the query builder.

3. Serialization groups over ad-hoc arrays. JMS groups (list, detail, write) let one entity render differently per endpoint. Laravel's JsonResource / ResourceCollection is the direct replacement — define toArray() per context rather than scattering ->only() calls.

4. Query building isolated in a service. Keep filtering, sorting, and pagination in a query service (or Eloquent scope) so the controller stays thin and the logic is unit-testable without HTTP.

5. Consistent envelope and error shape. The bundle inherits FOSRestBundle's exception/error handling. In Laravel, standardize on one response shape (data, meta, errors) via a response macro or base controller method — retrofitting consistency later is painful.

6. Integration tip: if you must interoperate with a Symfony service running this bundle, consume its HTTP API rather than its PHP classes. The contracts are the routes and JSON shapes, not the abstract classes.

Gotchas and Tips

  • Dead-end dependency chain. Symfony 4 is EOL, FOSRestBundle is retired, and this bundle pins those versions. Installing it in a modern Symfony 5/6/7 project will fail dependency resolution or require --ignore-platform-reqs gymnastics that you will regret.
  • Zero community surface. 1 star, 0 dependents, no issue backlog to learn from. Any bug you hit, you fix yourself — assume no upstream support.
  • No Flex recipe. Bundle registration is manual (config/bundles.php), and there is no config/packages/*.yaml to publish. You will hand-write FOSRest, JMS, and Lexik config, and the bundle's expected keys won't be obvious.
  • Filter injection risk. Lexik filter forms applied loosely to a query builder are a classic path to unintended field exposure and expensive queries. Always whitelist filter fields and cap page size server-side.
  • Mass-assignment equivalent. Symfony Forms with allow_extra_fields or careless handleRequest can hydrate fields you didn't intend. In Laravel terms: your FormRequest::validated() output should be the only thing passed to create()/update().
  • Serialization group drift. JMS groups defined inline via annotations are easy to desync from reality. If you port this pattern, centralize the field lists and write a test asserting the JSON shape of each endpoint.
  • Debugging tips (Symfony side): bin/console debug:router to confirm the abstract controller actually generated routes, debug:container for the service wiring, and the profiler's Doctrine panel to catch N+1s introduced by serializing relations.
  • Extension points are inheritance, not composition. The bundle expects you to subclass abstract controllers and override protected methods. That's brittle and hard to test; if you're copying the idea into Laravel, prefer composing small traits/services over deep inheritance.
  • Verdict for a Laravel team: do not adopt. Read it once for the CRUD separation shape, then build the same thing with apiResource routes, FormRequests, query scopes, and JsonResources — you'll get a maintainable result in an afternoon with no EOL dependencies attached.
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.
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
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core