2017 © Pedro Peláez
 

symfony-bundle params-codec-bundle

Symfony bundle for obfuscating/encryption routing params.

image

aaugustyniak/params-codec-bundle

Symfony bundle for obfuscating/encryption routing params.

  • Saturday, May 6, 2017
  • by artur-augustyniak
  • Repository
  • 1 Watchers
  • 1 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

# ParamsCodecBundle

[Build Status] (https://travis-ci.org/artur-augustyniak/ParamsCodecBundle), (*1)

Provides a simple Symfony 2/3 Bundle to AES encrypt routing parameters., (*2)

Installing via Composer

{
    "require": {
        "aaugustyniak/params-codec-bundle": "dev-master"
    }
}

Using and Setting Up

composer

composer aaugustyniak/params-codec-bundle

AppKernel.php

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

Basic usage

This bundle registers param_codec service and twig extension providing two functions in relation with standard Twig url creation functions., (*3)

In default implementation ParamCodec interface is backed by AesCodec. ParamCodec uses secret passphrase from parameters.yml., (*4)

DefaultController.php

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
        ]);

    }

}

index.html.twig

{% extends 'base.html.twig' %}

{% block body %}


{% if decrypted_value is defined %}
Decrypted param: {{ decrypted_value }} BACK
{% else %}

{% verbatim %} {{ raw_value }} {% endverbatim %} {{ raw_value }} , (*5)

{% endif %}
{% endblock %}

The Versions

06/05 2017

dev-master

9999999-dev http://aaugustyniak.pl

Symfony bundle for obfuscating/encryption routing params.

  Sources   Download

MIT

The Requires

 

The Development Requires

06/05 2017

1.1.0

1.1.0.0 http://aaugustyniak.pl

Symfony bundle for obfuscating/encryption routing params.

  Sources   Download

MIT

The Requires

 

The Development Requires

17/03 2016

1.0.2

1.0.2.0 http://aaugustyniak.pl

Symfony bundle for obfuscating/encryption routing params.

  Sources   Download

MIT

The Requires

 

The Development Requires

17/03 2016

1.0.1

1.0.1.0 http://aaugustyniak.pl

Symfony bundle for obfuscating/encryption routing params.

  Sources   Download

MIT

The Requires

 

The Development Requires

10/03 2016

1.0.0

1.0.0.0 http://aaugustyniak.pl

Symfony bundle for obfuscating/encryption routing params.

  Sources   Download

MIT

The Requires

 

The Development Requires