PHPackages                             robbel-dev/data-provider - 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. robbel-dev/data-provider

ActiveLibrary

robbel-dev/data-provider
========================

2.6.2(1y ago)01.6kMITPHPPHP &gt;=7.2.0

Since Jul 5Pushed 1y agoCompare

[ Source](https://github.com/robbelDev/data-provider)[ Packagist](https://packagist.org/packages/robbel-dev/data-provider)[ RSS](/packages/robbel-dev-data-provider/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (7)Versions (31)Used By (0)

Xervice: DataProvider
=====================

[](#xervice-dataprovider)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/4225d161726d878be8f25f8279e51b99a96ff360add4d6f3aa2f1cf213ec9d84/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f786572766963652f646174612d70726f76696465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/xervice/data-provider/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/d5abd98210d4a29d23c0f185776f840d00650366c93e077eec4e40cfab0f2b79/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f786572766963652f646174612d70726f76696465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/xervice/data-provider/?branch=master)[![Build Status](https://camo.githubusercontent.com/ef345925be5eca121bb946a391728917f76736a77808d6138553eeadf1204642/68747470733a2f2f7472617669732d63692e6f72672f786572766963652f646174612d70726f76696465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/xervice/data-provider)

Data transfer objects for xervice packages.

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

[](#installation)

```
composer require xervice/data-provider

```

Configuration
-------------

[](#configuration)

You have to define, where to search for schema files and where to create the DTOs.

```

```

***Possible data types:***

- int
- string
- bool
- double (= float)
- float
- array
- object
- DataProviderInterface
- DataProviderInterface\[\]
- ***AnyNameOfDataProvider***

With the type "DataProviderInterface" you can set any DataProvider.

***Default values***You can define default values for the following types:

- int
- float
- double
- string
- bool
- array

For the type array only an empty array is possible as default. If you want to define an empty string as default for the type string, you have to set the default to ''.

```

```

Use DTO
-------

[](#use-dto)

```
    $dataProvider = new DataProvider\KeyValueDataProvider();

    // Set values
    $dataProvider->setKey('keyname');
    $dataProvider->setValue('value');

    // Get values
    $dataProvider->getKey();

    // Isset
    $dataProvider->hasKey();

    // you can also work with arrays
    $dataProvider->fromArray([
        'Key' => 'keyname',
        'Value' => 'value'
    ]);

    // and back to array
    $dataArray = $dataProvider->toArray();
```

***Extend and sharing***

Multiple schame-files with the same DataProvider name will be merged. Also you can choose another DataProvider as type or collection.

```

```

***Using***

```
