PHP code example of scaytrase / symfony-storable-forms

1. Go to this page and download the library: Download scaytrase/symfony-storable-forms 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/ */

    

scaytrase / symfony-storable-forms example snippets



    class AppKernel extends Kernel
    {
        public function registerBundles()
        {
            $bundles = array(
                new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
                \\ ....
                new ScayTrase\StoredFormsBundle\StoredFormsBundle(),
    


        $string = new StringField();
        $string->setName('string_type');

        $text = new TextAreaField();
        $text->setName('text_type');

        $number = new NumberField();
        $number->setName('number_type');

        $choice = new ChoiceField();
        $choice->setName('choice_type');
        $choice->setChoices(array('choice1', 'choice2'));

        /** @var AbstractField[] $fields */
        $fields = array($string, $text, $number, $choice);

        $builder = $this->factory->createBuilder('form');

        foreach ($fields as $field) {
            $field->buildForm($builder);
        }