PHP Classes

V3ctor WareHouse: Store and retrieve objects in MongoDB and MySQL

Recommend this page to a friend!
  Info   Example   Demos   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 93 All time: 9,900 This week: 455Up
Version License PHP version Categories
v3wh 1.0Custom (specified...5PHP 5, Databases
Description 

Author

This package can store and retrieve objects in MongoDB, MySQL and Microsoft SQL Server.

There is a factory class that will create instances of the warehouse classes.

The warehouse classes can create, retrieve, update and delete objects given their keys and values in PHP variables.

Picture of Yorch Ponce
Name: Yorch Ponce <contact>
Classes: 6 packages by
Country: Mexico Mexico
Age: 43
All time rank: 205922 in Mexico Mexico
Week rank: 192 Up4 in Mexico Mexico Up
Innovation award
Innovation award
Nominee: 1x

Example

<?php
require 'config.php';
require
'vendor/autoload.php';

// For JavaScript SDK
header("Access-Control-Allow-Origin: *");

// Init Database Connection
V3WareHouse::getInstance("v3MongoDB", $hostname, $username, $password, $dbname, $port);

// Init Application
$app = new V3Application($dbname, $key);

// Add Custom Route
$app->addRoute('/openshift', function () {
               
$app = \Slim\Slim::getInstance();

               
$app->response()->header('Content-Type', 'application/json');
               
$app->response()->status(200);

               
$msg = array("msg" => "Hello localhost !!!");

               
$envvar = getenv('OPENSHIFT_MONGODB_DB_HOST');

                if (! empty(
$envvar))
                   
$msg = array("msg" => "Hello Openshift !!!");
               
                echo
json_encode($msg);
            });

// Start V3ctor Application
$app->start();

?>


Details

V3 WareHouse Core

Description

V3ctor WareHouse Core for MongoDb and MySQL.

Requirements

Developer Documentation

Execute phpdoc -d v3wh/

Unit Test

For run Unit Test, complete information connection and execute the next commands: > phpunit V3WareHouseTest.php

Installation

Create file composer.json


{
    "require": {
    	"php": ">=5.4.0",
        "yorch/v3wh" : "dev-master",
        "monolog/monolog": "1.13.1",
        "catfan/medoo": "v1.1.2"
    }
}

Execute composer.phar install

Example


//$v3ctor = V3WareHouse::getInstance('v3Mongo', $hostname, $username, $password, $dbname, $port);

// For PHP 7
$v3ctor = V3WareHouse::getInstance('v3MongoDB', $hostname, $username, $password, $dbname, $port);

if (! $v3ctor->isConnected())
    die("Unable load V3ctor WareHouse");

$doc = array('r' => 666);

$newObject = $v3ctor->newObject("demo", $doc);

var_dump($newObject);

Notes

v3wh is a Core for MongoDb and needs php mongo module. For MySQL and SQL Server support is required _id field in the table, check demo.sql.

References

http://es.wikipedia.org/wiki/Singleton

P.D. Let's go play !!!


  Files folder image Files (12)  
File Role Description
Files folder imagev3mysql (3 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file demo.sql Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. License
Accessible without login Plain text file README.md Doc. Documentation
Plain text file V3WareHouse.class.php Class Class source
Accessible without login Plain text file V3WareHouseMyTest.php Test Class source
Accessible without login Plain text file V3WareHouseTest.php Test Class source
Plain text file WareHouse.class.php Class Class source

  Files folder image Files (12)  /  v3mysql  
File Role Description
  Accessible without login Plain text file create.php Example Example script
  Plain text file DB.php Class Class source
  Accessible without login Plain text file index.php Aux. Auxiliary script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:93
This week:0
All time:9,900
This week:455Up