Download the PHP package anfischer/dto without Composer
On this page you can find all versions of the php package anfischer/dto. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download anfischer/dto
More information about anfischer/dto
Files in anfischer/dto
Package dto
Short Description A PHP implementation of the Data Transfer Object pattern (https://martinfowler.com/eaaCatalog/dataTransferObject.html)
License MIT
Homepage https://github.com/anfischer/dto
Informations about the package dto
DTO - PHP Data Transfer Object
A PHP implementation of the Data Transfer Object pattern (https://martinfowler.com/eaaCatalog/dataTransferObject.html).
The Data Transfer Object allows for public properties with forced validation of their data types.
This implementation supports all of PHP's eight primitive data types:
- String
- Integer
- Double (or by PHP-implementation floating point numbers)
- Boolean
- Array
- Object
- Null
- Resource
As well as forced boolean values of:
- True
and - False
Install
Via Composer
Usage
The DTO class can be used to generate generic Data Transfer Objects which does not enforce initializing type, but guaranties strict types for initialized properties (e.g. a property which is first initialized as string can not be changed to integer later)
The DTO class also allows for generating type hinted Data Transfer Objects.
When forcing types properties can not be initialized with other types than defined for the
properties (e.g. a property which is defined as string can not be initialized as integer)
Finally, the DTO class allows for generating type hinted Data Transfer Objects with mixed types.
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Contributing
Please see CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Andreas Fischer
- All Contributors
License
The MIT License (MIT). Please see License File for more information.