Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tacone/datasource
Wrapper for arrays, plain objects and Eloquent
https://github.com/tacone/datasource
Last synced: 7 days ago
JSON representation
Wrapper for arrays, plain objects and Eloquent
- Host: GitHub
- URL: https://github.com/tacone/datasource
- Owner: tacone
- License: mit
- Created: 2015-09-27T19:51:33.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-02T22:06:33.000Z (about 9 years ago)
- Last Synced: 2024-08-07T15:13:47.705Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 207 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# DataSource
[![Build Status](https://travis-ci.org/tacone/datasource.svg?branch=master)](https://travis-ci.org/tacone/datasource)
[![Coverage Status](https://coveralls.io/repos/tacone/datasource/badge.svg?branch=master&service=github)](https://coveralls.io/github/tacone/datasource?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/tacone/datasource/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/tacone/datasource/?branch=master)A generic, wrapper object to easily access arrays, plain objects, laravel models
using the dotted syntax.For eloquent models, accessing and saving of related models is supported,
even though not all the relationship kinds are there yet.```php
$source = new DataSource(new Customer());
$source['name'] = 'Frank';
$source['surname'] = 'Sinatra';
$source['details.email'] = '[email protected]';
$source['details.twitter'] = '@therealfrankie';$source->save();
```## Requirements
- PHP 5.5.0
- Laravel 4.2 or greater.Laravel is not required if you only need to manipulate POJOs and arrays.
## Testing
To test this package you need to install it under a working Laravel
installation. Then `cd` in the package folder and run `php unit`.If you just want to develop this package and want to set up an ad hoc
installation of Laravel, you can use `script/test-with-laravel.php`.