System requirements
Before installing Laravel Data, ensure your environment meets these requirements:PHP Version
PHP 8.1 or higherThe package uses modern PHP features like constructor property promotion, named arguments, and attributes.
Laravel Version
Laravel 10, 11, 12, or 13Compatible with all recent Laravel versions for maximum flexibility.
Version compatibility
Laravel Data follows semantic versioning and maintains compatibility with multiple Laravel versions:| Laravel Data | PHP Version | Laravel Version |
|---|---|---|
| 4.x | ^8.1 | ^10.0 | ^11.0 | ^12.0 | ^13.0 |
The package uses Laravel’s package auto-discovery, so it works seamlessly with all supported Laravel versions without additional configuration.
Required PHP extensions
Laravel Data relies on the following PHP extensions, which are typically included in standard PHP installations:- JSON - For JSON encoding and decoding
- Reflection - For analyzing data object structures
- Mbstring - For string operations
These extensions are usually enabled by default in PHP 8.1+. If you encounter issues, verify they’re enabled in your
php.ini file.Recommended packages
While not required, these packages enhance Laravel Data’s functionality:Carbon (nesbot/carbon)
Carbon (nesbot/carbon)
For working with dates and times in data objects. Laravel includes Carbon by default.
Laravel TypeScript Transformer
Laravel TypeScript Transformer
For generating TypeScript definitions from your data objects.
Inertia.js
Inertia.js
For seamless integration with Inertia.js and lazy property support.
Livewire
Livewire
For using data objects in Livewire components.
Checking your environment
Verify your PHP version:composer.json:
Production considerations
OPcache
OPcache
Enable OPcache in production for better performance:
Caching
Caching
Enable structure caching in production (enabled by default):
Next steps
Installation
Install Laravel Data via Composer
Quickstart
Build your first data object