Phone number validation. There are two general formats accepted: +XX XXXXXXXXX or XXXX XXXXXXXXX. Whitespaces are not required.
namespace Foo\Forms;
use Phalcon\Forms\Element\Text;
use Vegas\Validation\Validator\Phone;
class Bar extends \Vegas\Forms\Form
{
public function initialize()
{
$phone = new Text('phone');
$phone->addValidator(new Phone([
'message' => $this->i18n->_('The phone number should be in the +XX XXXXXXXXX or XXXX XXXXXXXXX format.')
]));
$this->add($phone);
// ...
}
}