1. Go to this page and download the library: Download zvps/phalcon-validation 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/ */
zvps / phalcon-validation example snippets
class LoginForm extends Form
{
public function initialize($entity = null, $options = null)
{
$username = new Text('username', array(
'class' => 'form-control'
));
$username->setLabel('Username');
$username->addValidators(array(
new PresenceOf(array(
'message' => 'Please enter your username.',
)),
new AlphaNumericValidator(array(
'message' => 'Only Alpha, Numeric and Space characters please.',
'allowWhiteSpace' => true,
)),
new StringLength(array(
'max' => 100,
'messageMaximum' => 'Username is too long. Maximum 100 characters.',
)),
));
$this->add($username);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.