1. Go to this page and download the library: Download sokil/frontend-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.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sokil / frontend-bundle example snippets
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Sokil\FrontendBundle\FrontendBundle(),
);
}
}
namespace Acme\SiteBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class SpaController extends Controller
{
public function indexAction(Request $request)
{
if (!$this->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
throw $this->createAccessDeniedException();
}
// render response
return $this->render('SiteBundle:Spa:index.html.twig', [
'applicationData' => $this->get('acme.spa.app_data')->getData(), // optional appdata
]);
}
}
var someService = app.container.get('someService');