PHP code example of vereschak / url-encryptor-bundle

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

    

vereschak / url-encryptor-bundle example snippets


use Nzo\UrlEncryptorBundle\Annotations\ParamDecryptor;
//...

    /**
     * @ParamDecryptor(params={"id", "bar"})
     */
     public function indexAction($id, $bar)
    {
        // no need to use the decryption service here as the parameters are already decrypted by the annotation service.
        //...
    }
    
    
    
    use Nzo\UrlEncryptorBundle\Annotations\ParamEncryptor;
    //...
    
        /**
         * @ParamEncryptor(params={"id", "bar"})
         */
         public function indexAction($id, $bar)
        {
            // no need to use the encryption service here as the parameters are already encrypted by the annotation service.
            //...
        }

     public function indexAction($id) 
    {
        $MyId = $this->get('nzo_url_encryptor')->decrypt($id);

        //...
    }

     public function indexAction() 
    {   
        //...
        
        $Encrypted = $this->get('nzo_url_encryptor')->encrypt($data);
        //...
    }
 php
// app/AppKernel.php

public function registerBundles()
{
    return array(
        // ...
        new Nzo\UrlEncryptorBundle\NzoUrlEncryptorBundle(),
    );
}