PHP code example of ananchev / php-api-creator
1. Go to this page and download the library: Download ananchev/php-api-creator 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/ */
ananchev / php-api-creator example snippets
$currentEndpoint = "country";
$api = new PHPApiCreator($db_host, $db_name, $db_user, $db_pass);
$connection = $api->database_connection();
echo $api->SERVER_REQUEST($_SERVER, $token_code, $currentEndpoint, $connection);
$connection = $api->database_connection();
echo $api->SERVER_REQUEST($_SERVER, $token_code, $currentEndpoint, $connection);
$currentEndpoint = "country";
$this->token($SERVER, $token_code)->GET($_GET, $connection, $currentEndpoint);
$this->token($SERVER, $token_code)->POST($_POST, $connection, $currentEndpoint);
$inputs = file_get_contents("php://input");
$this->token($SERVER, $token_code)->PATCH($inputs, $connection, $currentEndpoint);
$inputs = file_get_contents("php://input");
$this->token($SERVER, $token_code)->DELETE($inputs, $connection, $currentEndpoint);
$host = "localhost";
$dbname = "your_database";
$user = "your_username";
$pass = "your_password";
$currentEndpoint = "country";
bash
composer text
project-root/
webservices/
country.php
users.php
orders.php
config.php
vendor/