Silex Zend Validate extension
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
src/Zf1
tests
.gitignore
README
license.txt

README

Zend_Validate extension.

This extension for the Silex microframework enables use Zend Framework's Zend_Validate.

<?php
require_once 'silex.phar';
require_once dirname(__DIR__) . '/src/Zf1/ValidateExtension.php';

$zendpath = getenv('ZF_PATH');

$app = new Silex\Application();
$app->register(new \Zf1\ValidateExtension(), array(
    'zend.class_path' => $zendpath,
));

$app->get('/error', function () use ($app) {
    $validator = $app['zend.validate']('alnum');
    $result    = $validator->isvalid('abcd++');
    if ($result === false) {
        $mssages = $validator->getMessages();
        var_dump($messages);
    }

    return $result;
});

Notice:
Running tests or examples code
1. Set Zend Framework1 library to your include_path export ZF_PATH='/path/to/zf1/path'
2. export include_path
  $ export ZF_PATH='/path/to/zf1/path'