Exemple #1
0
<?php

die("You are not allowed to access to the API. Check " . basename(__FILE__) . " for more information.");
require_once __DIR__ . '/../app/bootstrap.php.cache';
require_once __DIR__ . '/../app/ApiKernel.php';
//require_once __DIR__.'/../app/AppCache.php';
//$kernel = new AppCache(new ApiKernel('prod', false));
$kernel = new ApiKernel('prod', false);
//$kernel->loadClassCache();
// if you want to use the SonataPageBundle with multisite
// using different relative paths, you must change the request
// object to use the SiteRequest
use Sonata\PageBundle\Request\SiteRequest as Request;
//use Symfony\Component\HttpFoundation\Request;
$kernel->handle(Request::createFromGlobals())->send();
Exemple #2
0
<?php

use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = (require_once __DIR__ . '/../../apps/bootstrap.php.cache');
// Enable APC for autoloading to improve performance.
// You should change the ApcClassLoader first argument to a unique prefix
// in order to prevent cache key conflicts with other applications
// also using APC.
/*
$apcLoader = new ApcClassLoader(sha1(__FILE__), $loader);
$loader->unregister();
$apcLoader->register(true);
*/
require_once __DIR__ . '/../../apps/api/ApiKernel.php';
//require_once __DIR__.'/../app/AppCache.php';
$kernel = new ApiKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);