Skip to main content

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:
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.
While not required, these packages enhance Laravel Data’s functionality:
For working with dates and times in data objects. Laravel includes Carbon by default.
For generating TypeScript definitions from your data objects.
For seamless integration with Inertia.js and lazy property support.
For using data objects in Livewire components.

Checking your environment

Verify your PHP version:
You should see output similar to:
Verify your Laravel version in composer.json:
If you’re using PHP 8.0 or lower, you’ll need to upgrade to PHP 8.1 or higher before installing Laravel Data.

Production considerations

Enable OPcache in production for better performance:
Enable structure caching in production (enabled by default):

Next steps

Installation

Install Laravel Data via Composer

Quickstart

Build your first data object