Created
June 8, 2012 16:34
-
-
Save k-holy/2896706 to your computer and use it in GitHub Desktop.
composer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// autoload_namespace.php generated by Composer | |
$vendorDir = dirname(__DIR__); | |
$baseDir = dirname($vendorDir); | |
return array( | |
'Volcanus\\Validation' => $vendorDir . '/volcanus/validation/src/', | |
'Symfony\\Component\\HttpFoundation' => $vendorDir . '/symfony/http-foundation/', | |
'Symfony\\Component\\ClassLoader' => $vendorDir . '/symfony/class-loader/', | |
'SessionHandlerInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs', | |
'PHPTAL' => $vendorDir . '/phptal/phptal/classes/', | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "volcanus/validation", | |
"type": "library", | |
"description": "validation library", | |
"keywords": ["validation"], | |
"homepage": "https://github.com/k-holy/Volcanus_Validation", | |
"version": "0.2.0", | |
"license": "MIT", | |
"authors": [ | |
{ | |
"name": "k-holy", | |
"email": "[email protected]" | |
} | |
], | |
"require": { | |
"php": ">=5.3.3" | |
}, | |
"autoload": { | |
"psr-0": { "Volcanus\\Validation": "src/" } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "volcanus/validation", | |
"version": "dev-master", | |
"version_normalized": "9999999-dev", | |
"time": "2012-06-08 16:23:10", | |
"source": { | |
"type": "git", | |
"url": "https://github.com/k-holy/Volcanus_Validation.git", | |
"reference": "5aca0c4effd265bf8af8610b88fb7e5bd4ef74af" | |
}, | |
"dist": { | |
"type": "zip", | |
"url": "https://github.com/k-holy/Volcanus_Validation/zipball/5aca0c4effd265bf8af8610b88fb7e5bd4ef74af", | |
"reference": "5aca0c4effd265bf8af8610b88fb7e5bd4ef74af", | |
"shasum": "" | |
}, | |
"require": { | |
"php": ">=5.3.3" | |
}, | |
"type": "library", | |
"installation-source": "source", | |
"license": [ | |
"MIT" | |
], | |
"authors": [ | |
{ | |
"name": "k-holy", | |
"email": "[email protected]", | |
"homepage": null, | |
"role": null | |
} | |
], | |
"description": "validation library", | |
"homepage": "https://github.com/k-holy/Volcanus_Validation", | |
"autoload": { | |
"psr-0": { | |
"Volcanus\\Validation": "src/" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "volcanus/validation", | |
"type": "library", | |
"description": "validation library", | |
"keywords": [], | |
"homepage": "https://github.com/k-holy/Volcanus_Validation", | |
"version": "0.2.0", | |
"license": "MIT", | |
"authors": [ | |
{ | |
"name": "k-holy", | |
"email": "[email protected]" | |
} | |
], | |
"require": { | |
"php": ">=5.3.3" | |
}, | |
"autoload": { | |
"psr-0": { "Volcanus\\Validation": "src/" } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once realpath(__DIR__ . '/../../../vendor/autoload.php'); | |
use Symfony\Component\ClassLoader\UniversalClassLoader; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Volcanus\Validation\Context; | |
$loader = new UniversalClassLoader(); | |
$loader->registerPrefix('Phanda_', realpath(__DIR__ . '/../../../vendor/phanda/pathtranslator/src')); | |
$loader->register(); | |
$request = Request::createFromGlobals(); | |
$user_id = \Phanda_PathTranslator::getInstance()->getParameter(0); | |
$validation = new Context(array('user_id' => $user_id)); | |
$validation->check('user_id', 'notEmpty'); | |
$validation->check('user_id', 'int', ['min' => 1, 'max' => 10]); | |
if (!$validation->isValid()) { | |
Response::create(sprintf('Invalid User ID "%s"', (string)$user_id), 400)->prepare($request)->send(); | |
} else { | |
Response::create(sprintf('User ID "%s"', (string)$user_id), 200)->prepare($request)->send(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"repositories": [ | |
{ | |
"type": "package", | |
"package": { | |
"name": "smarty/smarty", | |
"version": "3.1.8", | |
"dist": { | |
"url": "http://www.smarty.net/files/Smarty-3.1.8.zip", | |
"type": "zip" | |
}, | |
"source": { | |
"url": "http://smarty-php.googlecode.com/svn/", | |
"type": "svn", | |
"reference": "tags/Smarty_3_1_8/distribution/" | |
} | |
} | |
}, | |
{ | |
"type":"package", | |
"package": { | |
"name": "phanda/pathtranslator", | |
"version": "dev-master", | |
"dist": { | |
"url": "https://github.com/k-holy/Phanda_PathTranslator/zipball/master", | |
"type": "zip" | |
}, | |
"source": { | |
"url": "https://github.com/k-holy/Phanda_PathTranslator.git", | |
"type": "git", | |
"reference": "master" | |
} | |
} | |
} | |
], | |
"require": { | |
"symfony/class-loader": "2.1.*", | |
"symfony/http-foundation": "2.1.*", | |
"phptal/phptal": ">=1.2.1", | |
"smarty/smarty": "3.1.*", | |
"phanda/pathtranslator": "dev-master", | |
"volcanus/validation": "dev-master" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment