Simple IP validation for both IPv4 and IPv6.
namespace Foo\Forms;
use Phalcon\Forms\Element\Text;
use Vegas\Validation\Validator\Ip;
class Bar extends \Vegas\Forms\Form
{
public function initialize()
{
$ip = new Text('ip');
$ip->addValidator(new Ip([
'message' => $this->i18n->_('Invalid IP!')
]));
$this->add($ip);
// ...
}
}