antoi/restify-bundle
Reusable Symfony bundle (6.4–8.x, PHP 8.2+) that provides a full REST CRUD stack: abstract repository/service/controller, automatic entity hydration, query filtering, eager-loading, and pick-based response enrichment. Six endpoints per resource, quickly wired.
list, show, create, etc.) accelerates MVP development._gte, _like) provides SQL-like query flexibility without requiring custom repository methods for 80% of use cases. Reduces need for ad-hoc DQL in controllers.pick=lastLogin.ip) without modifying serialization groups. Critical for APIs with variable data needs (e.g., dashboards).ValidatorInterface ensures consistent 422 error responses, reducing frontend integration effort. However, this assumes validation groups (getReadGroups()) are properly defined.ApiResponse/PaginatedResponse envelopes enforce consistency across endpoints, simplifying client-side parsing (e.g., pagination metadata in meta).Anti-Patterns:
bundles.php) is sufficient for basic use. Complex setups (e.g., custom hydration) may require extending core classes.AbstractRestRepository, defeating the bundle’s purpose.getCustomQueryBuilder() for edge cases.getFilterableFields() could generate inefficient queries if getDefaultJoins() isn’t optimized. N+1 queries may occur for deeply nested pick traversals.fetch="EAGER" or DQL for critical paths. Limit pick depth in production.getWritableFields() must stay in sync with entity validation groups (getReadGroups()). Mismatches can lead to silent failures or inconsistent errors.symfony/maker-bundle to keep them aligned.pick=orders.items.price) may expose sensitive data or fail if properties are missing. No built-in access control.PickResolver or use Symfony’s voter system to restrict traversal.InvalidPayloadException) may conflict with existing error listeners.pick responses?success, data, meta) and error formats (400/404/422) simplify frontend integration.create()/update() may require extensive method overrides.api-platform or symfony/ux-live-component for reactive UIs.User or Product).pick queries, and error responses.Assert annotations to align with getWritableFields().AbstractRestService) for custom logic rather than forking.getFilterableFields() and getDefaultJoins() based on query patterns.pick traversals if exposing sensitive data.symfony/validator for 422 error responses. Conflicts unlikely if using standard validation groups.symfony/serializer; ensure no custom normalizers conflict with PickResolver.AbstractRestController; avoid mixing with manual route annotations.AbstractRestRepository; override getCustomQueryBuilder() for custom DQL.AbstractRestService; hook into lifecycle methods (e.g., prePersist) for custom logic.composer require antoi/restify-bundle.config/bundles.php.AbstractRestRepository for a pilot resource (e.g., User).getFilterableFields() and getDefaultJoins() based on query patterns.AbstractRestService withHow can I help you explore Laravel packages today?