2017 © Pedro Peláez
 

library boolean-form-type

Boolean form type for Symfony REST APIs

image

fsevestre/boolean-form-type

Boolean form type for Symfony REST APIs

  • Wednesday, October 4, 2017
  • by fsevestre
  • Repository
  • 1 Watchers
  • 2 Stars
  • 2,768 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 210 % Grown

The README.md

Boolean form type

Boolean form type for Symfony REST APIs., (*1)

Installation

The recommended way to install this library is through Composer., (*2)

Require the fsevestre/boolean-form-type package by running the following command:, (*3)

$ composer require fsevestre/boolean-form-type

This will resolve the latest stable version and install all the dependencies., (*4)

Otherwise, install the library and setup the autoloader yourself., (*5)

Usage

$builder->add('enabled', BooleanType::class);

By default, the form type use a data transformer which will transform the value to true (1, '1', true and 'true') or false (0, '0', false and 'false')., (*6)

If you want to support more values, you can override the true_values and false_values form type options:, (*7)

$builder
    ->add('enabled', BooleanType::class,
        array(
            'true_values' => array(1, '1', true, 'true', 'on', 'yes'),
            'false_values' => array(0, '0', false, 'false', 'off', 'no'),
        )
    )
;

Note: The form type is not intended to be displayed on a browser: use the built-in CheckboxType form type provided by Symfony instead., (*8)

Tests

To setup and run tests follow these steps:, (*9)

$ composer install
$ bin/phpunit

Contributing

See CONTRIBUTING file., (*10)

License

This library is distributed under the MIT license., (*11)

The Versions

04/10 2017

dev-master

9999999-dev https://github.com/fsevestre/BooleanFormType

Boolean form type for Symfony REST APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by Florent SEVESTRE

04/10 2017

v1.0.0

1.0.0.0 https://github.com/fsevestre/BooleanFormType

Boolean form type for Symfony REST APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by Florent SEVESTRE