PHP code example of herrera-io / silex-active-link
1. Go to this page and download the library: Download herrera-io/silex-active-link 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/ */
herrera-io / silex-active-link example snippets
use Herrera\Silex\ActiveLinkServiceProvider;
use Silex\Application;
use Silex\Provider\TwigServiceProvider;
use Symfony\Component\HttpFoundation\Request;
$app = new Application();
$app->get(
'/',
function (Application $app) {
return $app['twig']->render('test.html.twig');
}
)->bind('home');
$app->get(
'/page',
function (Application $app) {
return $app['twig']->render('test.html.twig');
}
)->bind('page');
$app->register(
new TwigServiceProvider(),
array(
'twig.path' => '/path/to/templates'
)
);
$app->register(
new ActiveLinkServiceProvider()
);
$app->run(
Request::create('/page')
);