PHP code example of pixeldev / sulu-townhallbundle

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

    

pixeldev / sulu-townhallbundle example snippets


 return [
     /* ... */
     Pixel\TownHallBundle\TownHallBundle::class => ['all' => true],
 ];
 



namespace Pixel\TownHallBundle\Controller\Website;

use Doctrine\ORM\EntityManagerInterface;
use Pixel\TownHallBundle\Entity\Setting;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;

class MeteoController extends AbstractController
{
    /**
     * @Route("meteo", name="meteo", options={"expose"=true}, methods={"POST"})
     */
    public function meteo(EntityManagerInterface $entityManager): JsonResponse
    {
        $setting = $entityManager->getRepository(Setting::class)->find(1);

        return new JsonResponse([
            "success" => true,
            "template" => $setting->getMeteo(),
        ]);
    }
}