Menu

APIS Log in to Edit

LongStone

APIS

An API in JCORE is an HTTP or CLI exposed directory that will load a specific set of plugins.

Basic API directory Structure

[API_NAME]/
    index.php
    config.php

index.php

index.php is the "harness" for the API

config.php

config.php defines all the settings for the API

API Configuration settings

file path settings:

/**
* JCORE DEFINES
* this is where we define the API
* first we set the basic file path settings
*/
define ("JCORE_BASE_DIR",       "/var/www/JCORE/CORE/");
define ("JCORE_CONFIG_DIR",     "/var/www/JCORE/CONFIG/"); 
define ("JCORE_CACHE_DIR",      "/var/www/JCORE/CACHE/");
define ("JCORE_TMP_DIR",        "/var/www/JCORE/CACHE/FILE/");
define ("JCORE_TEMPLATES_DIR",  "/var/www/JCORE/TEMPLATES/");
/**
* supporting services
*/
define ("JCORE_LOG_DIR", "/var/log/httpd/"); //make sure you have write access
define ("JCORE_FILE_CACHE_DIR", "/var/www/JCORE/CACHE/FILE/"); //make sure you have write access

define ("JCORE_PLUGINS_DIR", "/var/www/JCORE/PLUGINS/");
define ("JCORE_PACKAGES_DIR", "/var/www/JCORE/PACKAGES/");
//session_id(JCORE_SESSION_NAME);z

Sessions (if used)

$JCORE_SESSION_NAME = "DEFAULT-API-".getmypid();
define ("JCORE_SESSION_NAME", $JCORE_SESSION_NAME); //a-z, A-Z, 0-9 and '-,' 
//session_id(JCORE_SESSION_NAME);

System (opcode) Cache

#define ("JCORE_SYSTEM_CACHE", "EACCELERATOR");
define ("JCORE_SYSTEM_CACHE", "XCACHE");
define ("JCORE_SYSTEM_CACHE_SERIALIZATION", "JSON"); //JSON/NATIVE/RAW[string]

Transport Layer

define ("JCORE_API_DIR", "/var/www/VHOSTS/auth.deluxebusinessservices.com");
define ("JCORE_API_TRANSPORT_IN", "URI"); //    ARG/URI/JSONPRC/XML/SOAP
define ("JCORE_API_TRANSPORT_OUT", "HTML");

Bootstrap Routine

Cache Settings

#$BOOTSTRAP["CSN"] = JCORE_SYSTEM_CACHE; - MUST be disabled if no opcode cache
$BOOTSTRAP["CACHE_SERIALIZATION"] = 'JSON'; //[JSON/NATIVE]
$BOOTSTRAP["UNSERIALIZE_TYPE"] = 'ARRAY'; //[ARRAY/OBJECT]

Loading Bootstrap

require_once(JCORE_BASE_DIR.'/LOAD/BOOTSTRAP.php');

Registering Plugins to the API

$pluginList = array(
    'PLUGIN_1',
    'PLUGIN_3',
    'PLUGIN_***'
);

foreach($pluginList AS $key => $pluginName){
    $CONFIG_MANAGER->registerPlugin($pluginName); 
}

default_admin_http

default_http


Related

Wiki: Application Structure
Wiki: Home
Wiki: Installation
Wiki: Quick Start Guide

Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.