- How do I install crell/serde in a Laravel application?
- Install it with composer require crell/serde. No service provider or published configuration is required, so the package does not bootstrap itself into Laravel. A practical approach is to create a thin application-level serialization adapter so your code depends on your interface rather than directly on the package.
- Does crell/serde need a Laravel service provider or config file?
- No. crell/serde is a standalone PHP 8 serialization library with no framework bootstrapping, service provider, or published config. Any Laravel-specific concerns such as dependency injection wiring, configuration, and mapping serialization errors to HTTP responses are yours to implement.
- Which PHP and Laravel versions are compatible with crell/serde?
- The technical assessment indicates PHP 8.1+ and Laravel 9 through 11 align with serde's requirements and present no framework-level conflicts. You should still verify the package's Composer constraints in a sandbox before pinning versions. Confirm the supported matrix matches your runtime, especially if you are on older Laravel or PHP releases.
- Can crell/serde replace Laravel API Resources or Eloquent casts?
- No. It is intended as a boundary serialization layer for typed DTOs, such as queue payloads, webhook ingestion, third-party API responses, and config objects. Eloquent should continue to own persistence and relationships, while API Resources remain appropriate for presentation concerns. Use serde to define transport contracts, not to replace your persistence or validation pipeline.
- How does crell/serde handle missing fields, extra fields, and type mismatches?
- Those strictness semantics need explicit testing in your application because type coercion, unknown-field handling, and enum or DateTime behavior are the areas most likely to surprise teams. Write round-trip tests for each payload contract and decide what should happen on missing fields, extra fields, and mismatches. If errors must become HTTP 422 responses, map them in your adapter rather than assuming the library matches Laravel validation behavior.
- Is crell/serde production-ready despite its license and single maintainer?
- Treat the license as unresolved: the assessment lists it as NOASSERTION, which is a hard blocker until Legal confirms the actual terms and compatibility with your distribution model. The package is also single-maintainer with a relatively small adoption footprint, so pin versions, commit your lockfile, and be prepared to vendor or fork if upstream stalls. Do not ship it into a load-bearing boundary without sign-off.
- How does crell/serde compare with spatie/laravel-data and symfony/serializer?
- spatie/laravel-data is Laravel-native with a much larger community, while symfony/serializer is a mature option that is bundled optionally with Laravel. crell/serde is a standalone, attribute-driven PHP library that is format-agnostic across JSON, YAML, and CSV and can share DTO contracts with non-Laravel services. Choose it only if that decoupled, multi-format boundary is a concrete gap your current baseline does not cover.
- How do I serialize JSON, YAML, and CSV into typed DTOs with crell/serde?
- Annotate typed DTO properties or constructor parameters with attributes such as Field and SerializeAs. The mapping is defined once on the DTO and is format-agnostic, so the same contract can hydrate from JSON, YAML, or CSV. Nested structures, enums, and flexible field naming are handled through those attributes rather than per-format boilerplate.
- What performance issues should I expect from crell/serde with large payloads?
- Reflection and attribute metadata resolution per class are not free, so mapper caching and benchmarking are important. Benchmark the largest realistic payload and your expected requests per second before committing to the boundary. If reflection overhead becomes material, cache mappers or reconsider the integration.
- How should I test a crell/serde integration in Laravel?
- Start with a sandbox round-trip on one real payload and explicitly test backed enums, DateTimeImmutable handling and timezone fidelity, float/null and empty-array versus empty-object JSON fidelity, nested objects, arrays of objects, and constructor promotion with required versus optional parameters. Then add contract tests in your adapter so changes to strictness or field naming are caught. Keep the integration behind your own interface so swapping to symfony/serializer or spatie/laravel-data remains a single-file change.