PHP code example of gdbots / app-bundle

1. Go to this page and download the library: Download gdbots/app-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/ */

    

gdbots / app-bundle example snippets


declare(strict_types=1);

namespace AppBundle\Controller;

use Gdbots\Bundle\AppBundle\Controller\DeviceViewRendererTrait;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

final class DefaultController extends Controller
{
    use DeviceViewRendererTrait;

    /**
     * @Route("/")
     *
     * @return Response
     */
    public function indexAction(): Response
    {
        // if device_view is populated and the template index.smartphone.html.twig exists, it will be used
        // otherwise the "index.html.twig" file will be loaded.
        return $this->renderUsingDeviceView('@app/index%device_view%.html.twig');
    }
}