Download the PHP package antwerpes/data-transfer-object without Composer
On this page you can find all versions of the php package antwerpes/data-transfer-object. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download antwerpes/data-transfer-object
More information about antwerpes/data-transfer-object
Files in antwerpes/data-transfer-object
Package data-transfer-object
Short Description Simple json encoding and decoding for PHP data objects
License MIT
Homepage https://github.com/antwerpes/data-transfer-object
Informations about the package data-transfer-object
Data Transfer Object
Simple library for encoding and decoding JSON structures into PHP objects, e.g. to work with API responses in a strongly typed way.
Installation
You can install the package via composer:
Usage
Define a class that extends Antwerpes\DataTransferObject\DataTransferObject
and define the structure of the object:
Then you can use the class to decode JSON strings into PHP objects:
Custom Casters
You can define custom casters by implementing the Antwerpes\DataTransferObject\CastsProperty
interface:
Mapping
You can map nested properties to a flat structure using the Map
attribute:
Validation
Validation is out of scope for this package, use JSON schemas or other libraries like symfony/validator
to validate the object.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions are welcome! Leave an issue on GitHub, or create a Pull Request.
Credits
- Elisha Witte
- All Contributors
License
The MIT License (MIT). Please see License File for more information.