tenantcloud / data-transfer-objects
PHP data transfer objects
Installs: 52 808
Dependents: 6
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=8.3
- ext-json: *
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
- spatie/macroable: ^1.0|^2.0
- tenantcloud/php-standard: 1.2 || ^1.4 || ^2.0
Requires (Dev)
- orchestra/testbench: ^7.0|^8.5|^9.0|^10.0
- pestphp/pest: ^3.8
- php-cs-fixer/shim: ^3.75
- phpstan/phpstan: ^2.1.17
- phpstan/phpstan-mockery: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-webmozart-assert: ^2.0
- tenantcloud/php-cs-fixer-rule-sets: ~3.4.1
This package is auto-updated.
Last update: 2025-08-02 15:57:39 UTC
README
Laravel data transfer objects.
Requirements
- PHP version >=7.4.1
- Docker (optional)
Installation
Require this package with composer.
composer require tenantcloud/data-transfer-objects
Examples
// Create empty data object.
$data = ExampleDTO::create();
// Serialize for array or json
$data->toArray();
$data->toJson();
// Create from existing data
$data = ExampleDTO::from(['foo']);
// Check is property filled
$data->hasFoo();
// Get foo property
$data->getFoo();
// Set property
$data->setFoo($foo);
Commands
Install dependencies:
docker run -it --rm -v $PWD:/app -w /app composer install
Run tests:
docker run -it --rm -v $PWD:/app -w /app php:7.4-cli vendor/bin/phpunit
Run php-cs-fixer on self:
docker run -it --rm -v $PWD:/app -w /app composer cs-fix