PHP code example of teamicon / apikit

1. Go to this page and download the library: Download teamicon/apikit library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

teamicon / apikit example snippets



use \teamicon\apikit\className;
$foo = new className();
...




use \teamicon\apikit\{list of classes that you will use separated by comma}
...
//header for CORS calls
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST, GET, PATCH, DELETE, OPTIONS");
header("Access-Control-Max-Age: 100");
//header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Headers: X-SC, X-LNG, AccountKey,x-requested-with, Content-Type, origin, authorization, accept, client-security-token, host, date, cookie, cookie2");
header("Content-Type: application/json");
//preflight test
if ($_SERVER['REQUEST_METHOD'] != 'OPTIONS') echo RouteManager::Start( 'route');
function route(string $sc, string $url, string $lng, RouteParameters $rp) {
    //put here your logic
}

public function GetSC() : string { return $this->sc; }
public function GetLanguage() : string { return $this->lng; }
public function GetMethod() : string { return $this->method; }
public function GetEntity() : string { return $this->entity; }
public function GetAction() : string { return $this->action; }
public function GetKeys() : array { return $this->keys; }

public static function Curl(string $url, string $method, bool $forceHeaders = false, array $headers = [], array $params = []) : array
public static function GenerateRandomToken(int $numOfChar) : string
public static function GetClientIp() : string
public  static function GetClientLanguage() : string