1. Go to this page and download the library: Download stcer/syar 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/ */
stcer / syar example snippets
use syar\Server;
use syar\log\File as FileLog;
use syar\log\Log;
$vendorPath = __Your vendor path__;
/** @var \Composer\Autoload\ClassLoader $loader */
$loader = example\service\Test();
$server->setDispatcher(function(\syar\Token $token, $isDocument) use ($service){
if(!$isDocument){
$method = $token->getMethod();
$params = $token->getArgs();
$value = call_user_func_array(array($service, $method), $params);
} else {
$value = "Yar api document";
}
return $value;
});
$server->run(['max_request' => 10000]);