PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Yorch Ponce  >  v3application  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: v3application
Creates an API for storing data using Slim
Author: By
Last change: Medoo library version updated
Date: 3 years ago
Size: 1,585 bytes
 

Contents

Class file image Download

V3ctor WareHouse Web Application

Description

V3ctorWH is a Web Application REST API for V3 WareHouse Core.

Requirements

Installation

Clone Repository Execute php composer.phar install

Create config.php


$hostname = 'DB_HOST';
$username = 'DB_USER';
$password = 'DB_PASSWORD';
$dbname   = 'DBNAME';
$port     = 27017;
$key      = "KEY";

Examples


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

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

// For PHP 7
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();

?>

References

https://en.wikipedia.org/wiki/Representational_state_transfer

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

For more information send a message to info at phpclasses dot org.