Giter VIP home page Giter VIP logo

anydataset's Introduction

AnyDataset

Opensource ByJG SensioLabsInsight Scrutinizer Code Quality Build Status Code Coverage

Anydataset Core Module. Anydataset is an agnostic data source abstraction layer in PHP.

Features

  • Access different data sources using the same interface.
  • Iterable results
  • Convert results to array

Current Implementations

{:.table}

Object Data Source Read Write Reference
DbDriverInterface Relational DB yes yes Github
AnyDataSet Anydataset yes yes Github
ArrayDataSet Array yes no Github
TextFileDataSet Delimited Fields yes no Github
FixedTextFileDataSet Fixed Size fields yes no Github
XmlDataSet Xml yes no Github
JSONDataSet Json yes no Github
SparQLDataSet SparQl Repositories yes no Github
NoSqlDocumentInterface NoSql Document Based yes yes Github
KeyValueInterface NoSql Key/Value Based yes yes Github

Examples

Iterating with foreach

<?php
$dataset = new \ByJG\AnyDataset\Core\AnyDataset("example");

$iterator = $dataset->getIterator();
foreach ($iterator as $row) {
    print $row->toArray();
}

Filtering results

<?php
$filter = new \ByJG\AnyDataset\Core\IteratorFilter();
$filter->addRelation("field1", \ByJG\AnyDataset\Core\Enum\Relation::EQUAL, 10);
$iterator2 = $dataset->getIterator($filter);

Conveting to Array

<?php
$iterator = $dataset->getIterator();
print_r($iterator->toArray());

Iterating with While

<?php
$iterator = $dataset->getIterator();
while ($iterator->hasNext()) {
    $row = $iterator->moveNext();
    
    print_r($row->get("field1"));
}

Install

Just type: composer require "byjg/anydataset=4.0.*"

Running Unit tests

vendor/bin/phpunit

Open source ByJG

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.