- What is fsi/data and what problem does it solve in Laravel?
- fsi/data is a lightweight data transfer object package for Laravel/PHP that turns arrays, request payloads, and models into typed, structured data objects. It centralizes casting, validation, and transformation logic in reusable classes so controllers, models, and views do not accumulate repetitive mapping code. It is not a replacement for Eloquent or the query builder.
- How do I install fsi/data in a Laravel application?
- Install it with Composer using composer require fsi/data, then check the README for any service provider or configuration steps. Verify the PHP, Laravel, and doctrine/dbal constraints in composer.json before installing. Run the package in a non-critical module first to confirm autoloading, configuration, and testability.
- Does fsi/data support Laravel 10, 11, or 12?
- fsi/data does not publish a supported Laravel version matrix in the provided context, so verify composer.json and the README before adoption. The package targets Laravel/PHP and has low ecosystem validation, so test the exact Laravel and PHP versions in a spike. Do not assume Laravel 10, 11, or 12 support without checking constraints.
- How do I create a typed DTO with fsi/data from an array, request, or model?
- Define a DTO class with typed properties and use fsi/data to create instances from arrays, request payloads, or models. The package centralizes casting and validation hooks so the same data object can move between application layers. Confirm the exact constructor and mapping API in the README for your installed version.
- Can fsi/data validate request data and cast values automatically?
- Yes, fsi/data includes built-in validation and casting hooks for data objects. This helps centralize rules and transformations instead of repeating them in controllers or models. Test validation failures, nullable fields, and type coercion against your Laravel version.
- Does fsi/data support nested data objects and collections?
- fsi/data supports nested data objects and collections, which is useful for structured API payloads and form data. Verify how the package handles nulls, missing keys, and collection item casting in your use case. Keep nesting shallow and test performance for large payloads.
- How should I test fsi/data DTOs in a Laravel project?
- Unit test DTO creation from arrays, requests, and models, plus casting and validation outcomes. Add integration tests if the package registers Laravel services or depends on doctrine/dbal behavior. Pin Composer versions and run CI on the DBAL 4 path if you rely on it.
- Is fsi/data maintained and safe for production use?
- Treat fsi/data as unproven for production: the TPM assessment notes low adoption, zero stars, and zero dependents. Release 1.3.0 is only a doctrine/dbal constraint widening, not a maturity milestone. Request license clarity, CI coverage, issue activity, and a fork plan, and isolate it behind internal interfaces before committing.
- Why does fsi/data depend on doctrine/dbal, and does that affect upgrades?
- Release 1.3.0 widened fsi/data to doctrine/dbal ^4.0, confirming DBAL sits in its dependency surface. DBAL major upgrades can be breaking, so a package that tracks them loosely may add upgrade churn alongside Eloquent. Ask whether CI exercises DBAL 4 and pin the dependency in your spike.
- What are alternatives to fsi/data for DTOs in Laravel?
- Alternatives include native typed PHP classes, custom DTO mapping, Eloquent API resources, repositories or actions, and dedicated packages such as Spatie Laravel Data. Compare them on Laravel version support, validation integration, maintenance, and lock-in. fsi/data fits best as a contained spike or greenfield module, not a wholesale Eloquent replacement.