06. January 2013

Composer - Speed up PHP Composer install with different protocols

If you found composer is slow at cloning, you can add this to composer.json

// add to config section composer.json
"config": {
    "bin-dir": "bin",
    "process-timeout": "10000",
    "github-protocols": ["https"]
},

This would change protocol use to clone from git (by default) to https which is much faster.

05. January 2013

Symfony2 – add legends in a FormType class

In order to add extra variable in a Symfony 2 form type(in this example, the legend) in FormView, you have to implement this in your form type class.

use Symfony\Component\Form\FormViewInterface;
use Symfony\Component\Form\FormInterface;

//...

public function buildView(FormView $view, FormInterface $form, array $options)
{
    //this add the label, aka legend of the form
    $view->vars = array_replace($view->vars, array(
        'label'        => 'Asset',
    ));
}