1. Go to this page and download the library: Download oasis/http 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/ */
oasis / http example snippets
use Oasis\Mlib\Http\SilexKernel;
use Symfony\Component\HttpFoundation\Response;
$config = [];
$isDebug = true;
$kernel = new SilexKernel($config, $isDebug);
$kernel->get('/', function() {
return new Response("Hello world!");
});
$kernel->run();
use Oasis\Mlib\Http\SilexKernel;
use Silex\Provider\HttpCacheServiceProvider;
/** @var SilexKernel $kernel */
$kernel->register(new HttpCacheServiceProvider());
use Silex\Provider\HttpCacheServiceProvider;
$config = [
"providers" => [
new HttpCacheServiceProvider(),
],
];
// initialize SilexKernel with $config
use Symfony\Component\HttpFoundation\JsonResponse;
class MyViewHandler
{
function __invoke($rawResult, Symfony\Component\HttpFoundation\Request $request)
{
return new JsonResponse($rawResult);
}
}