tenantcloud / data-transfer-objects
PHP data transfer objects
Installs: 21 863
Dependents: 5
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: >=8.2
- ext-json: *
- illuminate/support: ^9.0|^10.0|^11.0
- spatie/macroable: 1.0.1
- tenantcloud/php-standard: 1.2 || ^1.4 || ^2.0
Requires (Dev)
- orchestra/testbench: ^7.0|^8.5
- pestphp/pest: ^2.8
- php-cs-fixer/shim: ^3.54
- phpstan/phpstan: ~1.10.21
- phpstan/phpstan-mockery: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- phpstan/phpstan-webmozart-assert: ^1.2
- tenantcloud/php-cs-fixer-rule-sets: ~3.4.0
This package is auto-updated.
Last update: 2024-11-04 14:24:24 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