{"id":37235165,"url":"https://github.com/codezero-be/validator","last_synced_at":"2026-01-15T04:00:48.990Z","repository":{"id":19566999,"uuid":"22816180","full_name":"codezero-be/validator","owner":"codezero-be","description":"🚫[ABANDONED] Form input validator","archived":true,"fork":false,"pushed_at":"2014-08-22T22:43:07.000Z","size":156,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-25T15:16:48.707Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codezero-be.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-10T18:55:55.000Z","updated_at":"2023-01-28T16:04:46.000Z","dependencies_parsed_at":"2022-08-21T08:50:28.814Z","dependency_job_id":null,"html_url":"https://github.com/codezero-be/validator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/codezero-be/validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codezero-be%2Fvalidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codezero-be%2Fvalidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codezero-be%2Fvalidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codezero-be%2Fvalidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codezero-be","download_url":"https://codeload.github.com/codezero-be/validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codezero-be%2Fvalidator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-15T04:00:48.287Z","updated_at":"2026-01-15T04:00:48.960Z","avatar_url":"https://github.com/codezero-be.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Form Input Validator #\n\n[![Build Status](https://travis-ci.org/codezero-be/validator.svg?branch=master)](https://travis-ci.org/codezero-be/validator)\n[![Latest Stable Version](https://poser.pugx.org/codezero/validator/v/stable.svg)](https://packagist.org/packages/codezero/validator)\n[![Total Downloads](https://poser.pugx.org/codezero/validator/downloads.svg)](https://packagist.org/packages/codezero/validator)\n[![License](https://poser.pugx.org/codezero/validator/license.svg)](https://packagist.org/packages/codezero/validator)\n\nThis package provides an easy to use interface to handle server side form validation and lets you create your custom form validation classes without much effort.\n\nAlthough the core of this package is not bound to any framework, I have included a ServiceProvider and ValidationService implementation specifically for [Laravel](http://www.laravel.com/).\n\nI have also included a ValidationTrait and a facade (both for Laravel) so you can use this package in a way you like best (see below for more).\n\n## Installation ##\n\nInstall this package through Composer:\n\n    \"require\": {\n    \t\"codezero/validator\": \"1.*\"\n    }\n\n## Laravel 4 Implementation ##\n\nAfter installing, update your `app/config/app.php` file to include a reference to this package's service provider in the providers array:\n\n    'providers' =\u003e [\n\t    'CodeZero\\Validator\\ValidatorServiceProvider'\n    ]\n\nThis package will automatically register the `Validate` alias, if this is not already taken.\n\nYou can handle failed validations by catching the ValidationException. One automated way is to add the following handler to `app/start/global.php`. But you could as easily catch it in a try/catch block.\n\n\tApp::error(function(CodeZero\\Validator\\Exceptions\\ValidationException $exception)\n\t{\n\t    return Redirect::back()-\u003ewithInput()-\u003ewithErrors($exception-\u003egetErrors());\n\t});\n\n\n### Laravel Specific Usage ###\n\n#### 1. Create a FormValidator to validate your form ####\n\n\tuse CodeZero\\Validator\\FormValidator;\n\n\tclass UpdateUserForm extends FormValidator {\n\n\t\t/**\n\t     * Validation rules\n\t     *\n\t     * @var array\n\t     */\t\n\t    protected $rules = [\n\t        'name' =\u003e 'required',\n\t        'email' =\u003e 'required|email|unique,email,{userId}'\n\t    ];\n\t\n\t}\n\nNote the `{userId}` placeholder as an example.\n\n#### 2. Handle the input ####\n\nCreate your form and then handle the input in your controller in one of the following ways.\n\n##### Validate with a facade: #####\n\n\t$input = Input::all();\n\t$vars = ['{userId}' =\u003e $someUser-\u003eid];\n\n\tValidate::form('UpdateUserForm', $input, $vars);\n\nYou can pass the input and any placeholder key/value pairs as the second and third parameter, but if you leave both off, the package will automatically fetch `Input::all()` for you.\n\nTo have typesafety or autocomplete in IDE's, you might do this instead:\n\n\tValidate::form(get_class(UpdateUserForm), $input, $vars);\n\nOr if you use PHP 5.5 or above, this is even cleaner:\n\n\tValidate::form(UpdateUserForm::class, $input, $vars);\n\n##### Validate with a trait: #####\n\n\tuse CodeZero\\Validator\\Support\\ValidatorTrait;\n\t\n\tclass HomeController extends BaseController {\n\t\n\t    use ValidatorTrait;\n\t\n\t\tpublic function update()\n\t\t{\n\t        $input = Input::all();\n\t        $vars = ['{userId}' =\u003e $someUser-\u003eid];\n\t\n\t\t\t$this-\u003evalidate(UpdateUserForm::class, $input, $vars);\n\t        \n\t        return Redirect::to('/');\n\t\t}\n\t\n\t}\n\n#### 3. Show any validation errors ####\n\nShowing the errors in your form is as easy as doing this for each field:\n\n\t{{ $errors-\u003efirst('name', '\u003cp\u003e:message\u003c/p\u003e'); }}\n\nThat's it!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodezero-be%2Fvalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodezero-be%2Fvalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodezero-be%2Fvalidator/lists"}