PHPackages                             zendrop/data - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. zendrop/data

ActiveLibrary

zendrop/data
============

This package allows you to created DataTransferObjects without pain

v2.0.5(1y ago)397.5k↓45.7%MITPHPPHP ^8.1CI passing

Since Feb 19Pushed 1y ago5 watchersCompare

[ Source](https://github.com/12thbean/data)[ Packagist](https://packagist.org/packages/zendrop/data)[ RSS](/packages/zendrop-data/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (14)Used By (0)

zendrop/data
============

[](#zendropdata)

Installation
------------

[](#installation)

To install the package via Composer, run the following command:

```
composer require zendrop/data
```

How To Use
----------

[](#how-to-use)

### Creating Data Models

[](#creating-data-models)

1. **Implement Interfaces:** Your models should implement `DataInterface` and `ToArrayInterface`.
2. **Use Traits:** Incorporate `DataTrait` and `ToArrayTrait` for functionality.
3. **Handle Arrays:** For validating arrays, use the `ArrayOf` attribute. Mark fields that can be skipped with Skippable.
4. **Nested Structures:** You can create models within models.
5. **Enums:** Use BackedEnum for enum types.

### Code Example

[](#code-example)

```
