Weave Code
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 Entity Manager

Rest Entity Manager Laravel Package

alberto-leon-crespo/rest-entity-manager

View on GitHub
Deep Wiki
Context7

Symfony Rest Entity Manager to integrate rest resource management in symfony entity flow

Frequently asked questions about Rest Entity Manager
Can this package be used in Laravel to proxy requests between my API and external corporate/internal REST services?
Yes, this package is designed for exactly that use case. It handles data transformation between your Laravel entities and external REST services, making it ideal for acting as an intermediary API layer. The serializers and connection managers abstract away the complexity of mapping between your database and external APIs.
What Laravel versions are officially supported by this package?
The package is built for Laravel 8+ and 9+ due to its Symfony-inspired architecture. While it may work on older versions, compatibility isn’t guaranteed. Check the package’s `composer.json` or GitHub issues for version-specific notes, as Laravel’s dependency injection system evolved significantly after v7.
How do I configure the package to work with Eloquent models instead of Symfony entities?
The package uses metadata-driven mapping, so you’ll need to define how your Eloquent models correspond to external REST resources via configuration (e.g., `alc_rest_entity_manager.metadata_class_reader`). The serializers will handle converting between Laravel’s collections/arrays and the external API’s JSON payloads. Documentation for Laravel-specific setup is limited, so you may need to extend the metadata reader.
Does this package support filtering and pagination for external API responses before returning them to Laravel?
Yes, the `parameters_processor` service handles filtering logic based on your REST connection configuration. You can define filters in the connection settings, and the package will apply them to incoming/outgoing requests. For pagination, you’ll need to configure the external API’s pagination parameters (e.g., `limit`, `offset`) in the connection metadata.
Will this package conflict with Laravel’s built-in API resources or Fractal/Dingo API?
Potentially, if you’re using Fractal or Dingo for serialization. This package includes its own serializers for REST entity mapping, so you’ll need to decide whether to use its serializers or integrate them with your existing ones. The package is designed to work alongside FOSRestBundle (Symfony), but Laravel’s ecosystem differs, so test thoroughly.
How do I handle authentication (e.g., API keys, OAuth) for external REST services?
Authentication is configured per REST connection in the package’s settings. You can define headers (e.g., `Authorization: Bearer {token}`) or query parameters in the connection metadata. The package doesn’t enforce a specific auth method, so you’ll need to map Laravel’s auth (e.g., Sanctum, Passport) to the external API’s requirements manually.
Are there performance concerns with using interceptors or events for every REST request?
Interceptors and events add abstraction layers, which can introduce overhead. The package’s design suggests these are optional—you can disable them if not needed. For high-throughput systems, benchmark the impact of interceptors (e.g., logging, request transformation) and consider caching responses or using Laravel’s queue system to offload processing.
Can I customize the request/response transformation logic without extending the package?
Yes, the package provides hooks like `alc_rest_entity_manager.jms_event_subscriber` for event-driven customization. You can also override the `parameters_processor` or `serializer` services in Laravel’s service container to inject your own logic. For example, bind a custom processor in your `AppServiceProvider` to modify filtering or serialization behavior.
How do I handle errors or failed requests to external APIs?
The package includes a `logger` service to track REST request failures. You can extend this or add custom error handlers by subscribing to events (e.g., `rest.entity.manager.error`). For Laravel-specific error handling, wrap the package’s client calls in a `try-catch` block and throw Laravel exceptions (e.g., `HttpException`) to integrate with your error pages or logging.
What are the alternatives to this package for Laravel REST proxying?
For Laravel, consider `guzzlehttp/guzzle` (for raw HTTP clients) + custom middleware, `spatie/laravel-api-resources` (for API responses), or `darkaonline/l5-swagger` (for API documentation). If you need Symfony-like features, `api-platform/client` (with Laravel bridges) or `nelmio/api-doc-bundle` (Symfony) might be closer fits, though they require more adaptation. This package is unique in its entity-manager approach.
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.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware