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
Input Manager Bundle

Input Manager Bundle Laravel Package

alexanevsky/input-manager-bundle

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Input Manager Bundle
How do I integrate Input Manager Bundle into a Laravel project that doesn’t use Symfony?
Install the required Symfony bridge packages (`symfony/validator`, `symfony/translation`) via Composer, then register the `InputManager` as a Laravel service provider. The package works with Laravel’s native `Request` object by converting it to JSON/array before deserialization, so no deep Symfony dependency is mandatory.
Can I use this package for Eloquent models instead of Doctrine entities?
Yes, but you’ll need to adapt the `EntityFromId` attribute or custom logic to fetch Eloquent models by ID. The core deserialization and validation workflow remains the same, as the package focuses on input transformation rather than ORM-specific operations.
What’s the performance impact of using Input Manager for high-traffic APIs (e.g., 10K+ RPS)?
The package adds overhead due to deserialization, validation, and mapping layers. For high-throughput APIs, benchmark your payload size and complexity—deeply nested or large JSON (>1MB) may cause latency. Consider caching validated inputs or optimizing validator constraints.
How does this compare to Laravel’s built-in Form Request validation?
Input Manager Bundle offers more granular control over input transformation (e.g., nested objects, type conversion) and integrates with Symfony’s validation system, which is stricter for complex rules. Form Requests are simpler for basic validation but lack the DTO pattern and custom modifiers.
Is there built-in support for API resource serialization/deserialization like API Platform?
No, this package focuses on deserializing input into DTOs and mapping them to entities, not serializing entities back to API responses. You’d need to pair it with Laravel’s `Resource` classes or a separate serialization library for API output.
How do I handle custom validation logic beyond Symfony’s constraints?
Use the `ExtendedValidator` to create custom validators by implementing the `ValidatorInterface`. This allows you to inject business logic (e.g., checking database uniqueness) while keeping validation decoupled from your controllers or services.
Will this work with Laravel 10+ and the latest Symfony components?
The package is designed to work with Laravel’s Symfony bridge packages, which are regularly updated. Ensure you’re using compatible versions of `symfony/validator` and `symfony/translation` (e.g., ^6.0 for Laravel 10). Check the package’s `composer.json` for explicit version requirements.
How do I mock InputManager and validators in PHPUnit tests?
Mock the `InputManager` interface directly in your tests, focusing on its public methods like `deserialize()`, `validate()`, and `map()`. For validators, mock the `ValidatorInterface` or use Laravel’s `Validator` facade if you’re mixing validation systems.
Can I use this for non-API use cases, like CLI commands or form submissions?
Yes, the package is agnostic to the input source. For CLI commands, pass an array or JSON string to the deserializer. For forms, convert the submitted data (e.g., `$request->all()`) into an array before processing, though you’ll need to handle file uploads separately.
What’s the best way to handle errors and translate validation messages in Laravel?
Use Laravel’s built-in localization system for error messages by extending the `TranslatableMessage` class or integrating Symfony’s translator. For production, ensure your translation files (e.g., `resources/lang/en/validation.php`) include all custom validator messages.
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor