Download the PHP package akrabat/rka-slim-zendform without Composer
On this page you can find all versions of the php package akrabat/rka-slim-zendform. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package rka-slim-zendform
Zend\Form integration with Slim 3
This service provider integrates Zend\Form into a Slim 3 application.
Usage
composer require slim/twig-viewcomposer require akrabat/rka-slim-zendform- Register Twig-View as per the README
-
Register the
FormProviderin index.php:$app->getContainer()->register(new RKA\Form\FormProvider); -
Create a form:
<?php namespace RKA; use Zend\Form\Form; use Zend\InputFilter\InputFilterProviderInterface; class ExampleForm extends Form implements InputFilterProviderInterface { public function init() { $this->add([ 'name' => 'email', 'options' => [ 'label' => 'Email address', ], 'attributes' => [ 'id' => 'email', 'class' => 'form-control', 'required' => 'required', ], ]); $this->add([ 'name' => 'submit', 'type' => 'button', 'options' => [ 'label' => 'Go!', ], 'attributes' => [ 'class' => 'btn btn-default', ], ]); } public function getInputFilterSpecification() { return [ 'email' => [ 'required' => true, 'filters' => [ ['name' => 'StringTrim'], ['name' => 'StripTags'], ], 'validators' => [ ['name' => 'EmailAddress'], ], ], ]; } } -
Example action:
$app->map(['GET', 'POST'], '/', function ($request, $response) { $sm = $this['serviceManager']; $formElementManager = $sm->get('FormElementManager'); $form = $formElementManager->get("RKA\ExampleForm"); if ($request->isPost()) { $data = $request->post(); $form->setData($data); $isValid = $form->isValid(); if ($form->isValid()) { echo "Success!"; exit; } } $this['view']->render($response, 'home.twig', array( 'form' => $form )); return $response; });
All versions of rka-slim-zendform with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.4.0
pimple/pimple Version ~3.0
zendframework/zend-form Version ^2.4
zendframework/zend-servicemanager Version ^2.4
zendframework/zend-i18n Version ^2.4
zendframework/zend-view Version ^2.4
zendframework/zend-escaper Version ^2.4
pimple/pimple Version ~3.0
zendframework/zend-form Version ^2.4
zendframework/zend-servicemanager Version ^2.4
zendframework/zend-i18n Version ^2.4
zendframework/zend-view Version ^2.4
zendframework/zend-escaper Version ^2.4
The package akrabat/rka-slim-zendform contains the following files
Loading the files please wait ...