Download the PHP package jnariai/simple-dto without Composer
On this page you can find all versions of the php package jnariai/simple-dto. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jnariai/simple-dto
More information about jnariai/simple-dto
Files in jnariai/simple-dto
Package simple-dto
Short Description A simple data transfer object for Laravel
License MIT
Homepage https://github.com/jnariai/simple-dto
Informations about the package simple-dto
Simple DTO
Immutable Data Transfer Object (DTO) for PHP inspired by Laravel Data and Bags
Introduction
This is a package to create minimal immutable Data Transfer Object for PHP with some handy features like the method from to create the dto from array, it implements Arrayable
and Jsonable
interfaces, and also has two attributes to use #[NonNullOutput]
and #[Hidden]
to help in the output transformation.
Installation
You can install the package via composer:
Usage
You can create the DTO using the static function from::
and pass an array of data
You can also get a toArray an toJson method
You also get two available attributes to use. #[NonNullOutput]
and #[Hidden]
.
#[NonNullOutput]
is a class Attribute and when using toArray or toJson it will only return properties that are not null.
#[Hidden]
is a property Attribute and when using toArray or toJson it will not return the property.
License
The MIT License (MIT). Please see License File for more information.
All versions of simple-dto with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^12.0||^11.0