2017 © Pedro Peláez
 

library superform

Advanced form processing for phalcon framework inspired by Laravel and Zend forms

image

encodez/superform

Advanced form processing for phalcon framework inspired by Laravel and Zend forms

  • Monday, May 11, 2015
  • by encodez
  • Repository
  • 1 Watchers
  • 6 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Superform

Simple way to create and validate Phalcon 2 form inpired by the laravel request, (*1)

Please fork this repository and help improve.

The module is in development stage. This is a quick reference. Still the module and documentation has to be improved. I will be adding more notes as I get time, (*2)

example:, (*3)

use Encodez\Superform\Form;
class ClientForm extends Form
{
    public function __construct()
    {
        $this->setMethod(Form::METHOD_POST);
        parent::__construct();
    }

    function getFields()
    {
        return [
            'client_name' => [ 'text', 'Client Name', 'class:form-control'],
            'email' => ['email', 'EMail', 'class:form-control'],
            'building_no' => ['numeric', 'Building No', 'class:form-control'],
            'location_name' => [ 'text', 'Location Name', 'class:form-control location'],
        ];
    }

    function getRules()
    {
        return [
            'client_name' => 'required|length:5,10',
            'building_no' => 'required',
            'email' => 'required|email',
            'location_name' => 'required',
        ];
    }

    /* TODO: Add sanitizers*/
    function getFilters()
    {
        return [
            'client_name' => 'trim'
        ];
    }

    function getCustomMessages()
    {
        return [
            'client_name:required' => 'Client name is required',
            'client_name:length:5,10' => 'Client name must be atleast 5 characters and must not exceed 10',
            'client_name:string' => 'Client name contains invalid characters',
        ];
    }
}

The Versions

11/05 2015

dev-master

9999999-dev

Advanced form processing for phalcon framework inspired by Laravel and Zend forms

  Sources   Download

GPL-3.0

by Muneer Shaheed