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:
Laravel DataPHP VersionLaravel 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.
While not required, these packages enhance Laravel Data’s functionality:
For working with dates and times in data objects. Laravel includes Carbon by default.
composer require nesbot/carbon
For generating TypeScript definitions from your data objects.
composer require spatie/laravel-typescript-transformer
For seamless integration with Inertia.js and lazy property support.
composer require inertiajs/inertia-laravel
For using data objects in Livewire components.
composer require livewire/livewire

Checking your environment

Verify your PHP version:
php -v
You should see output similar to:
PHP 8.1.0 (cli) (built: Nov 25 2021 10:45:23) ( NTS )
Verify your Laravel version in composer.json:
{
    "require": {
        "laravel/framework": "^10.0|^11.0|^12.0|^13.0"
    }
}
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:
opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=10000
Enable structure caching in production (enabled by default):
// config/data.php
'structure_caching' => [
    'enabled' => true,
],

Next steps

Installation

Install Laravel Data via Composer

Quickstart

Build your first data object

Build docs developers (and LLMs) love