2017 © Pedro Peláez
 

library soupmix

Simple PHP database adapters to handle low level CRUD operations.

image

mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  • Saturday, May 14, 2016
  • by mkorkmaz
  • Repository
  • 5 Watchers
  • 3 Stars
  • 46 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 20 Versions
  • 0 % Grown

The README.md

Soupmix

Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality, (*1)

Simple PHP low level database adapters collection to handle CRUD operations. This library does not provide any ORM or ODM., (*2)

Adapters

  • MongoDB: Exists
  • Elasticsearch: Exists
  • Couchbase: Planned
  • MySQL: Planned
  • PostgreSQL: Planned

Installation

It's recommended that you use Composer to install Soupmix., (*3)

$ composer require  --prefer-dist mkorkmaz/soupmix "*"

This will install Soupmix and all required dependencies. Soupmix requires PHP 5.4.0 or newer, mongodb extension: 1.1.0 or newer, mongo-php-library library or newer form MongoDB, elasticsearch-php library or newer for Elasticsearch, (*4)

Documentation

API Documentation: See details about the db adapters functions:, (*5)

Usage

// Connect to MongoDB Service
$adapter_config = [];
$adapter_config['db_name'] ='db_name';
$adapter_config['connection_string']="mongodb://127.0.0.1";
$adapter_config['options'] =[];
$m=new Soupmix\Adapters\MongoDB($adapter_config);

// Connect to Elasticsearch Service
$adapter_config             = [];
$adapter_config['db_name']  = 'indexname';
$adapter_config['hosts']    = ["127.0.0.1:9200"];
$adapter_config['options']  = [];

$e=new Soupmix\Adapters\ElasticSearch($adapter_config);

$docs = [];
$docs[] = [
    "full_name" => "John Doe",
      "age" => 33,
      "email"   => "johndoe@domain.com",
      "siblings"=> [
        "male"=> [
          "count"=> 1,
          "names"=> ["Jack"]
        ],
        "female"=> [
          "count" => 1,
          "names" =>["Jane"]
        ]      
      ]
];
$docs[] = [
    "full_name" => "Jack Doe",
      "age" => 38,
      "email"   => "jackdoe@domain.com",
      "siblings"=> [
        "male"=> [
          "count"=> 1,
          "names"=> ["John"]
        ],
        "female"=> [
          "count" => 1,
          "names" =>["Jane"]
        ]      
      ]
];

$docs[] = [
    "full_name" => "Jane Doe",
      "age" => 29,
      "email"   => "janedoe@domain.com",
      "siblings"=> [
        "male"=> [
          "count"=> 2,
          "names"=> ["Jack","John"]
        ],
        "female"=> [
          "count" => 0,
          "names" =>[]
        ]      
      ]
];

foreach($docs as $doc){
    // insert user into database
    $mongo_user_id = $m->insert("users",$doc);
    $es_user_id = $e->insert("users",$doc);

}
// get user data using id
$es_user_data = $e->get('users', "AVPHZO1DY8UxeHDGBhPT");


$filter = ['age_gte'=>0];
// update users' data that has criteria encoded in $filter
$set = ['is_active'=>1,'is_deleted'=>0];

$e->update("users",$)

$filter = ["siblings.male.count__gte"=>2];

//delete users that has criteria encoded in $filter
$e->delete('users', $filter);



// user's age lower_than_and_equal to 34 or greater_than_and_equal 36 but not 38
$filter=[['age__lte'=>34,'age__gte'=>36],"age__not"=>38];

//find users that has criteria encoded in $filter
$docs = $e->find("users", $filter);


Contribute

  • Open issue if found bugs or sent pull request.
  • Feel free to ask if you have any questions.

The Versions

14/05 2016

dev-master

9999999-dev https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

14/05 2016

0.2.15

0.2.15.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

14/05 2016

0.2.14

0.2.14.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

11/05 2016

dev-scrutinizer-patch-1

dev-scrutinizer-patch-1 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

11/05 2016

0.2.13

0.2.13.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

11/05 2016

0.2.12

0.2.12.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

08/05 2016

0.2.10

0.2.10.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

08/05 2016

0.2.11

0.2.11.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

28/04 2016

0.2.9

0.2.9.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

28/04 2016

0.2.8

0.2.8.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

08/04 2016

0.2.7

0.2.7.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

08/04 2016

0.2.6

0.2.6.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

06/04 2016

0.2.5

0.2.5.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

03/04 2016

0.2.4

0.2.4.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

02/04 2016

0.2.3

0.2.3.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

01/04 2016

0.2.2

0.2.2.0 https://github.com/mkorkmaz/soupmix

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database elasticsearch adapters

31/03 2016

0.2.1

0.2.1.0 https://github.com/mkorkmaz/db_adabters

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database adapters

30/03 2016

0.2

0.2.0.0 https://github.com/mkorkmaz/db_adabters

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database adapters

30/03 2016

0.1.2

0.1.2.0 https://github.com/mkorkmaz/db_adabters

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database adapters

29/03 2016

0.1.1

0.1.1.0 https://github.com/mkorkmaz/db_adabters

Simple PHP database adapters to handle low level CRUD operations.

  Sources   Download

MIT

The Requires

 

mongodb database adapters