{"id":18782888,"url":"https://github.com/jijihohococo/ichi-validation","last_synced_at":"2026-02-23T06:32:54.052Z","repository":{"id":56998997,"uuid":"455649479","full_name":"jijihohococo/ichi-validation","owner":"jijihohococo","description":"PHP Validation Library","archived":false,"fork":false,"pushed_at":"2025-12-27T02:54:34.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-28T18:45:17.167Z","etag":null,"topics":["open-source","php","php-validation","validation"],"latest_commit_sha":null,"homepage":"https://github.com/jijihohococo/ichi-validation","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/jijihohococo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-02-04T18:09:42.000Z","updated_at":"2025-12-27T02:54:26.000Z","dependencies_parsed_at":"2025-12-07T17:02:10.959Z","dependency_job_id":null,"html_url":"https://github.com/jijihohococo/ichi-validation","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"485e9ac9b312b51eb076271428e8f502ab5fa1f5"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jijihohococo/ichi-validation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jijihohococo%2Fichi-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jijihohococo%2Fichi-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jijihohococo%2Fichi-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jijihohococo%2Fichi-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jijihohococo","download_url":"https://codeload.github.com/jijihohococo/ichi-validation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jijihohococo%2Fichi-validation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29739021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T04:51:08.365Z","status":"ssl_error","status_checked_at":"2026-02-23T04:49:15.865Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["open-source","php","php-validation","validation"],"created_at":"2024-11-07T20:37:23.343Z","updated_at":"2026-02-23T06:32:54.005Z","avatar_url":"https://github.com/jijihohococo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ichi Validation\n\n\u003cp\u003eIchi Validation is the fast and secure PHP validation library.\u003c/p\u003e\n\n## License\n\nThis package is Open Source According to [MIT license](LICENSE.md)\n\n## Table of Content\n\n- [Ichi Validation](#ichi-validation)\n\t- [License](#license)\n\t- [Table of Content](#table-of-content)\n\t- [Installation](#installation)\n\t- [Testing](#testing)\n\t- [Using](#using)\n\t- [Validation Methods](#validation-methods)\n\t\t- [```required```](#required)\n\t\t- [```integer```](#integer)\n\t\t- [```string```](#string)\n\t\t- [```bool```](#bool)\n\t\t- [```double```](#double)\n\t\t- [```array```](#array)\n\t\t- [```email```](#email)\n\t\t- [```file```](#file)\n\t\t- [```image```](#image)\n\t\t- [```confirm```](#confirm)\n\t\t- [```min```](#min)\n\t\t- [```max```](#max)\n\t\t- [```unique```](#unique)\n\t\t- [```mime```](#mime)\n\t\t- [```between```](#between)\n\t\t- [```dimensions```](#dimensions)\n\t\t\t- [```width```](#width)\n\t\t\t- [```min_width```](#min_width)\n\t\t\t- [```max_width```](#max_width)\n\t\t\t- [```height```](#height)\n\t\t\t- [```min_height```](#min_height)\n\t\t\t- [```max_height```](#max_height)\n\t\t\t- [Using Multiple Sub-Methods](#using-multiple-sub-methods)\n\t\t- [```image_ratio```](#image_ratio)\n\t- [Customization](#customization)\n\t\t- [Customizing Error Message](#customizing-error-message)\n\t\t- [Customizing Validation Method](#customizing-validation-method)\n\n\n## Installation\n\n\n```php\n\ncomposer require jijihohococo/ichi-validation\n\n```\n\n## Testing\n\n```txt\n\nyour_project/vendor/jijihohococo/ichi-validation \u003e php test/index.php \n\n```\n\n## Using\n\nYou can validate the input data with \u003cb\u003eJiJiHoHoCoCo\\IchiValidation\\Validator\u003c/b\u003e.\n\nFor example, let's make the request which have 'name' , 'age' and 'email'.\n\nWe want to validate that 'name' is not null, 'age' must be integer and 'email' must be not null and avialable email format string\n\n```php\n\nuse JiJiHoHoCoCo\\IchiValidation\\Validator;\n\n$validator = new Validator();\n$boolResult = $validator-\u003evalidate($_REQUEST,[\n\t'name' =\u003e 'required' ,\n\t'age' =\u003e 'required|integer' ,\n\t'email' =\u003e ['required','email']\n]);\n\n// To get error messages in array if the boolResult is FALSE //\n\n$errorMessages=$boolResult==FALSE ? $validator-\u003egetErrors() : []; \n\n```\n\n\u003cb\u003eIf you want to validate the data with multiple methods, you can separate methods by adding ```| ``` between the methods or putting those methods in the array.\u003c/b\u003e\n\n\n## Validation Methods\n\nWhile validating data, the system will add the error message to this data in the validator object if this data is not passed the validation according to the related method.\n\n### ```required```\n\nTo validate the data is not null or not.\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'name' =\u003e 'required'\n]);\n\n```\n\n### ```integer```\n\nTo validate the data is integer or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'age' =\u003e 'integer'\n]);\n\n```\n\n### ```string```\n\nTo validate the data is string or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'phone' =\u003e 'string'\n])\n\n```\n\n### ```bool```\n\nTo validate the data is boolean or not\n\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'married' =\u003e 'bool'\n]);\n\n```\n\n\n### ```double```\n\nTo validate the data is double or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'weight' =\u003e 'double'\n]);\n\n```\n\n### ```array```\n\nTo validate the data is array or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'highlights' =\u003e 'array'\n]);\n\n```\n\n### ```email```\n\nTo validate the data is in the email format or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'email' =\u003e 'email'\n]);\n\n```\n\n### ```file```\n\nTo validate the ```$_FILES```'s parameter is null or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'file'\n]);\n\n```\n\n### ```image```\n\nTo validate the uploaded file is image or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'image'\n]);\n\n```\n\n### ```confirm```\n\nTo validate the \"field\" is same as \"confirm_field\" or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'password' =\u003e 'confirmed'\n]);\n\n```\n\nThis code is validating the \"password\" request is same as \"confirm_password\" or not\n\n### ```min```\n\nIf the data is string, it is aimed to validate the number of this data string length is greater than the declared minimum number or not.\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'name' =\u003e 'min:10'\n]);\n\n```\n\nIf the data is number, it is aimed to validate this number is greater than the declared minimum number or not.\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'age' =\u003e 'min:18'\n]);\n\n```\n\nIf the data is uploaded file, it is aimed to validate the size of this uploaded file is greater than the declared minimum MB number or not.\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'min:3'\n]);\n\n```\n\n### ```max```\n\nIf the data is string, it is aimed to validate the number of this data string length is less than the declared maximum number or not.\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'name' =\u003e 'max:10'\n]);\n\n```\n\nIf the data is number, it is aimed to validate this number is less than the declared maximum number or not.\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'age' =\u003e 'max:18'\n]);\n\n```\n\nIf the data is uploaded file, it is aimed to validate the size of this uploaded file is less than the declared maximum MB number or not.\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'max:3'\n]);\n\n```\n\n### ```unique```\n\nTo validate the data is exist in database's table or not\n\nYou must set PDO object firstly before using this method\n\n```php\n\n$validator-\u003esetPDO($pdoObject);\n\n```\n\nAnd then you can use this method.\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'email' =\u003e 'unique:user_table,email_field,NULL'\n]);\n\n```\n\nAbove code is validating request 'email' is same as any values of 'email_field' (column) of 'user_table' (table) or not.\n\nValidating the data with this way is used to check the data duplication while inserting new data into database.\n\nYou can also make this way to validate the same process.\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'email' =\u003e 'unique:user_table,email_field,'.NULL\n]);\n\n```\n\n\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\t\n\t'email' =\u003e 'unique:user_table,email_field,'. 1\n]);\n\n```\nAbove code is validating request 'email' is same as value of 'email_field' (column) where the id is not 1 of 'user_table' (table) or not.\n\nValidating the data with this way is used to check the data duplication while updating the data into database.\n\nIt is used where the primary key of the table is 'id'.\n\nIf the primary key of the table is not 'id', you must use the below code\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'email' =\u003e 'unique:user_table,email_field,'. 1.',user_id'\n]);\n\n```\n\n### ```mime```\n\nTo validate the uploaded file's extension is one of the specific file extensions or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'mime:png,jpg,jpeg,gif'\n]);\n\n```\n\n### ```between```\n\nTo validate the request number is between the specific two numbers or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'age' =\u003e 'between:18,25'\n]);\n\n```\n### ```dimensions```\n\nTo validate the uploaded image is specific dimensions or not\n\nThere are sub-methods in this method.\n\n1. ```width```\n2. ```min_width```\n3. ```max_width```\n4. ```height```\n5. ```min_height```\n6. ```max_height```\n\n#### ```width```\n\nTo validate the uploaded image's width is delcared width or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'dimensions:width=100' \n]);\n\n```\n\n#### ```min_width```\n\nTo validate the uploaded image's width is greater than the declared minimum width or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'dimensions:min_width=100'\n]);\n\n```\n\n#### ```max_width```\n\nTo validate the uploaded image's width is less than the delcared maximum width or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'dimensions:max_width=100'\n]);\n\n```\n\n#### ```height```\n\nTo validate the uploaded image's height is delcared width or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'dimensions:height=100'\n]);\n\n```\n\n#### ```min_height```\n\nTo validate the uploaded image's height is greater than the declared minimum height or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'dimensions:min_height=100'\n]);\n\n```\n\n#### ```max_height```\n\nTo validate the uploaded image's height is less than the delcared maximum height or not\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'dimensions:max_height=100'\n]);\n\n```\n\n#### Using Multiple Sub-Methods\n\nYou can validate your image's dimensions with multiple sub-methods\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'dimensions:width=100,height=100'\n]);\n\n```\n\n### ```image_ratio```\n\nTo validate the uploaded image width and height is same as the declared ratio\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'image' =\u003e 'image_ratio:1/3'\n]);\n\n```\n\n## Customization\n\n### Customizing Error Message\n\nYou can customize the error message for validation\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'name' =\u003e 'required',\n\t'email' =\u003e ['required','string','email']\n],[\n\t'required' =\u003e 'Data is required'\n]);\n\n```\n\nAbove code is customizing the error message when the 'required' validation method is not passed.\n\n```php\n\n$validator-\u003evalidate($_REQUEST,[\n\t'name' =\u003e 'required',\n\t'email' =\u003e 'required|string|email'\n],[\n\t'name.required' =\u003e 'Name is required',\n]);\n\n```\n\nAbove code is customizing the error message when the 'required' validation method for 'name' request is not passed.\n\n\n### Customizing Validation Method\n\nIf you want to create your own validation method, you must create the validation class.\n\nYou can create your validation class via commandline.\n\nFirstly you need to created the file named \"ichi\" under your project folder and use the below code in this file\n\n```php\n#!/usr/bin/env php\n\u003c?php\n\nrequire __DIR__.'/vendor/autoload.php';\n\nuse JiJiHoHoCoCo\\IchiValidation\\Command\\ValidationCommand;\n\n\n$validationCommand = new ValidationCommand;\n$validationCommand-\u003erun(__DIR__,$argv);\n\n```\n\nAnd then you can create the validation class in your commandline\n\n```php\n\nphp ichi make:validation TestValidation\n\n```\n\nThe default file folder is \"app/Validations\". So after making command, the validation class you created will be in the this default file folder. If you want to change the default folder path, you can change it in your \"ichi\" file.\n\n\n```php\n\n$validationCommand = new ValidationCommand;\n$validationCommand-\u003esetPath('new_app/Validations');\n$validationCommand-\u003erun(__DIR__,$argv);\n\n```\n\n\nYou must set the accepted validation rules in your created validation class.\nLet's make to accept only over age 21 in this created class to validate.\n\n```php\n\nnamespace App\\Validations;\nuse JiJiHoHoCoCo\\IchiValidation\\CustomValidator;\n\nclass TestValidation extends CustomValidator{\n\n\n\tpublic function __construct(){\n\n\n\t}\n\n\n\tpublic function rule(){\n\n\t\treturn $this-\u003evalue\u003e21;\n\t}\n\n\n\tpublic function showErrorMessage(){\n\n\t\treturn 'Your ' .$this-\u003eattribute . ' should be over 21.';\n\n\t}\n\n\n}\n```\n\nIn calling your validation class\n\n```php\n\nuse App\\Validations\\TestValidation;\n\n$validator = new Validator;\n$validator-\u003evalidate($_REQUEST,[\n\t'name' =\u003e 'required|string',\n\t'age' =\u003e ['required',new TestValidation()]\n]);\n```\n\n```php\n\n$this-\u003eattribute\n\n```\n\nIt is the validation data field name. For the example, it is 'age'.\n\n```php\n\n$this-\u003evalue\n\n```\n\nIt is the data value. For the example, it is the value of 'age' request.\n\nYou can pass other values in the constructor.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjijihohococo%2Fichi-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjijihohococo%2Fichi-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjijihohococo%2Fichi-validation/lists"}