PHP code example of proklung / wp-symfony-router-bundle
1. Go to this page and download the library: Download proklung/wp-symfony-router-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
proklung / wp-symfony-router-bundle example snippets
classSampleAjaxControllerextendsAbstractWPAjaxController{
publicfunctionaction(){
$this->checkTypeRequest('Invalid type request');
$response = new Response(
'OK',
Response::HTTP_OK
);
$response->headers->set('Content-Type', 'application/html; charset=utf-8');
$response->send();
wp_die();
}
}
useProkl\WpSymfonyRouterBundle\Services\Agnostic\RoutesConfigurator;
useProkl\WpSymfonyRouterBundle\Services\Agnostic\Router;
useProkl\WpSymfonyRouterBundle\Services\Agnostic\WpInitializerRouter;
$agnosticRouter = new RoutesConfigurator(
$_SERVER['DOCUMENT_ROOT'] . '/local/configs/standalone_routes.yaml',
$_SERVER['DOCUMENT_ROOT'] . '/wp-content/cache/routes', // Кэш; если null - без кэширования.
$_ENV['APP_DEBUG'] // Режим отладки или нет
);
$agnosticRouterInstance = new Router(
$agnosticRouter->getRouter(),
new WpInitializerRouter()
);