vx / ip-field-bundle
Ip form type for symfony 2 forms
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.3
- symfony/framework-bundle: 2.*
This package is not auto-updated.
Last update: 2025-01-28 02:12:30 UTC
README
Provide an ip field for symfony forms.
Requirements
- Symfony2.*
Installation
Composer
Add VxJsUploadBundle in your composer.json:
{ "require": { "vx/ip-field-bundle": "dev-master" } }
Now you can download the bundle with composer:
$ php composer.phar update vx/ip-field-bundle
AppKernel
Enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Vx\IpFieldTypeBundle\VxIpFieldTypeBundle(), ); }
Usage
Create field
Create your form :
$form = $this->createFormBuilder() ->add('ip', 'ipfield') ->add('send', 'submit')->getForm();
You can specify the ip version (ipv4
, ipv6
or mac
) :
->add('ip', 'ipfield', array('version' => 'ipv4'))
->add('ip', 'ipfield', array('version' => 'ipv6'))
->add('ip', 'ipfield', array('version' => 'mac'))
View
{{ form_start(form) }} {{ form_errors(form) }} <div class="control-group"> <label class="control-label" for="ip">IP</label> <div class="controls"> {{ form_widget(form.ip, { 'id': 'my_ip_field', 'class': 'form-control' }) }} </div> </div> {{ form_rest(form) }} {{ form_end(form) }}
Licence
This bundle is under the MIT Licence.