PHP Classes

V3ctor WareHouse: Store and retrieve objects in MongoDB and MySQL

Recommend this page to a friend!
  Info   View files Example   Demos   View files View files (12)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 93 This week: 1All time: 9,876 This week: 560Up
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: 42
All time rank: 206022 in Mexico Mexico
Week rank: 411 Up8 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  
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  /  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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:93
This week:1
All time:9,876
This week:560Up