- What is UniSharp Laravel DataCarrier used for?
- It is a lightweight Laravel package for moving structured data between application layers. You wrap arrays or objects in a data carrier and pass that payload into services, actions, and jobs instead of relying on loose associative arrays. It also provides a Laravel facade and configuration for querying DataCarrier lookup APIs when you need data enrichment or validation calls.
- How do I install unisharp/laravel-datacarrier?
- Install it with Composer using composer require unisharp/laravel-datacarrier. The package is designed for Laravel and should be discovered automatically by the framework. Check the README and Packagist metadata for the current version constraints before adding it to an existing project.
- Do I need to publish configuration for Laravel DataCarrier?
- Basic use of the data carrier requires no configuration, which keeps the package footprint minimal. If you are using the DataCarrier service lookup APIs through the facade, you will likely need to publish and adjust the package config with your service settings as described in the README.
- How do I create and use a data carrier in Laravel?
- Define a carrier once around the array or object you want to transport, then inject or pass it into your service, action, or job. Read values through the package's consistent accessor API rather than indexing an array with undocumented keys. This keeps controllers thin and makes business logic easier to test.
- Does Laravel DataCarrier work with queues and jobs?
- Yes, the package is intended to work cleanly with Laravel actions and queues. Because the payload is wrapped in a carrier object, make sure the contents you pass to a queued job are serializable. The immutable design helps avoid unexpected mutations while the job is waiting to run.
- Can I use DataCarrier outside Laravel or in unit tests?
- The data carrier is described as framework-agnostic and immutable, so it is easy to unit test without booting a full Laravel application. You can instantiate carriers directly in tests and assert on the values returned by the accessor API. The facade and configuration layer are Laravel-specific, so those parts require the framework.
- Which PHP and Laravel versions are supported by unisharp/laravel-datacarrier?
- The provided package context does not list specific PHP or Laravel version constraints. Check the Composer require block, README, and Packagist page for the exact supported versions before installing. Laravel's package auto-discovery should handle service provider registration on supported framework versions.
- How is Laravel DataCarrier different from using arrays or DTOs?
- It avoids passing around associative arrays with undocumented keys by giving you a consistent accessor API and sensible defaults. Compared with a full DTO setup, it is a lightweight wrapper that requires no configuration and minimal boilerplate. It is not a replacement for a complete DTO or validation layer, but it can make payload transport clearer and more testable.
- How do I read values and set defaults with the data carrier?
- Use the carrier's documented accessor methods to retrieve values from the wrapped payload. The package provides sensible defaults so missing keys can be handled consistently instead of triggering undefined-index errors. Refer to the README for the exact method names and default behavior in your installed version.
- Is unisharp/laravel-datacarrier suitable for production?
- It is a minimal-footprint package with no required configuration for basic data carrying, which makes it easy to adopt incrementally. For production, pin a tested Composer version, review the GitHub releases and issue tracker, and cover your carrier usage with unit tests. If you rely on the external DataCarrier lookup APIs, add error handling and monitoring around those calls.