PHP code example of aaugustyniak / params-codec-bundle

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

    

aaugustyniak / params-codec-bundle example snippets


$bundles = [
    ...,
    new Aaugustyniak\ParamsCodecBundle\ParamsCodecBundle()
];

use Aaugustyniak\ParamsCodecBundle\Annotations\DecryptParams;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;


class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction(Request $request)
    {
        /**
         * Value to be encrypted in resulting url/path
         */
        $rawValue = "Some secret internal value";
        return $this->render('default/index.html.twig', [
            'raw_value' => $rawValue,
        ]);
    }


    /**
     * @DecryptParams()
     *
     * @Route("/display/{param}", name="display")
     * @param $param
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function displayAction($param)
    {
        /**
         * Using @DecryptParams() annotation $param is auto decrypted
         */
        return $this->render('default/index.html.twig', [
            'decrypted_value' => $param
        ]);

    }
    
}
param_codec