A bundle with useful functions and template for swiss bvr+

1.0.0 2014-06-26 13:38 UTC


The goal of this bundle is to help you generating swiss BVR+ with Symfony2. For more information and documentation about BVR+ (in french) go to




Using Composer (Symfony 2.1+)

  • Add a new line to your composer.json file:
"require": {
    "sirgix/bvr-bundle": "1.0.*@dev"
  • Run a command
php composer.phar update
  • Add a new line to app/AppKernel.php:
$bundles = array(
  new sirgix\BvrBundle\BvrBundle(),

A Quick Start guide

The BVR classes

There are currently 2 bvr classes extending an abstract bvr class. If you just need to generate the encoding lines, you need to instantiante the bvr class and fill all the variables:

        $bvr = new PosteBVR();
        $bvr->setPaymentFor('test testson
        route des chemins 4
        1000 tonvillage');//Provide an adress. It will be displayed with nl2br
        $bvr->setPaymentFrom(/*see paymentFor*/);
        $bvrRender = $this->get("sirgix.bvr.renderer");
        echo $bvrRender->renderBVR($bvr);

Generate the HTML to print the BVR

I have provided some html for the generation of the bvr html template. This can be used with mpdf to render a PDF. It should be placed at the end of a page. It has been tested with

        $bvrRender = $this->get("sirgix.bvr.renderer");
        echo $bvrRender->renderBVR($bvr);//$bvr is an instance of a BVR class



Some banks have different ways to use the reference number. PosteBVR is the standard one. UbsBVR implements it for the UBS Bank


This is still work in progress and there could be bugs. Use at your own risk.