- How do I install digital-craftsman/deserializing-connection in a Laravel project?
- Install it via Composer with composer require digital-craftsman/deserializing-connection:0.7.* to pin to the current minor version. Since it is a Symfony bundle, you will also need Symfony Bridge components like symfony/dependency-injection and symfony/http-kernel for Laravel integration. Create a custom service provider to bind the package's connection interface to Laravel's database manager.
- Can I use this Symfony bundle with Laravel 10 or 11?
- Yes, but it requires adaptation because the package is designed as a Symfony bundle. Laravel 10+ with PHP 8.4 or 8.5 is compatible per package requirements, but you must bridge Symfony's service container and event system with Laravel's. Use Symfony Bridge components and a custom service provider to resolve the abstraction gap.
- What are the requirements for using deserializing-connection with Laravel?
- You need PHP 8.4 or 8.5 and Laravel 10 or later. The package is a Symfony bundle, so you also need Symfony Bridge components such as symfony/dependency-injection and symfony/property-access. Your application should already use DTOs and be comfortable with Symfony-style configuration like YAML or XML mappings.
- How do I configure DTO mappings for Laravel when using this package?
- DTO mappings are configured Symfony-style, typically via YAML or XML files, not Laravel's PHP attributes. You will need to adapt the configuration loading to work within Laravel's service provider bootstrapping. Consider wrapping the mapping logic in a Laravel service provider or using a bridge to translate configuration.
- Does digital-craftsman/deserializing-connection work with Eloquent or Laravel's query builder?
- The package uses its own DeserializingConnection abstraction rather than Laravel's ConnectionInterface. It may work with Laravel's query builder if you configure it to use Doctrine DBAL or Laravel's DatabaseManager through an adapter. Expect friction where the package assumes Symfony-specific connection abstractions.
- What are the alternatives to deserializing-connection for DTO hydration in Laravel?
- Native Laravel alternatives include spatie/data-transfer-object combined with custom query builder extensions or manual hydration using map() on Eloquent results. If you use Doctrine ORM, this package may integrate more natively. Rolling a custom DTO hydrator with Laravel's toArray() and casting is another option.
- Is digital-craftsman/deserializing-connection production-ready for Laravel apps?
- The package is used in production but is pre-1.0, so breaking changes occur between minor versions. For Laravel, additional risk comes from the Symfony-Laravel abstraction gap, which requires a custom adapter layer. Pin to 0.7.* and monitor the changelog and upgrade guide before deploying.
- How does this package handle performance compared to manual DTO hydration in Laravel?
- Performance overhead is considered low risk, but you should benchmark DTO hydration against raw Eloquent or query builder results. The package abstracts database-to-DTO mapping, which may add slight overhead versus manual mapping. Profile critical queries and consider caching hydrated DTOs if needed.
- What breaking changes should I expect before version 1.0 of deserializing-connection?
- Breaking changes are described in the releases and changelog, and they occur between minor versions. Pin your Composer requirement to the current minor version, like 0.7.*, to avoid unexpected upgrades. Review the upgrade guide when moving to a new minor version.
- How do I test DTO hydration with this package in Laravel using Pest or PHPUnit?
- The package is thoroughly tested, including mutation testing, but its test suite is Symfony-oriented. In Laravel, you may need to adjust tests for bundle-specific behavior and service container bindings. Write integration tests that bind the DeserializingConnection to Laravel's database manager and verify DTO output against expected results.