{"id":16461934,"url":"https://github.com/milwad-dev/laravel-validate","last_synced_at":"2025-04-08T11:12:29.697Z","repository":{"id":65069208,"uuid":"514654582","full_name":"milwad-dev/laravel-validate","owner":"milwad-dev","description":"Help to write easy \u0026 faster advance validation for Laravel","archived":false,"fork":false,"pushed_at":"2024-04-10T19:43:42.000Z","size":412,"stargazers_count":429,"open_issues_count":1,"forks_count":39,"subscribers_count":11,"default_branch":"1.x","last_synced_at":"2024-04-10T22:51:15.328Z","etag":null,"topics":["advance-validation","larave-package","laravel","laravel-eloquent-validation","laravel-rule","laravel-validate","laravel-validate-package","laravel-validate-rule","laravel-validation","laravel-validation-library","localization","php","rule","validate","validation","validation-rule"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/milwad/laravel-validate","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/milwad-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"custom":["https://payping.ir/@milwad-dev"]}},"created_at":"2022-07-16T18:21:06.000Z","updated_at":"2024-04-15T09:52:34.778Z","dependencies_parsed_at":"2024-03-01T16:47:37.617Z","dependency_job_id":"2bfcaa1d-53c1-4fa4-825d-85eda5913128","html_url":"https://github.com/milwad-dev/laravel-validate","commit_stats":{"total_commits":229,"total_committers":6,"mean_commits":"38.166666666666664","dds":0.09170305676855894,"last_synced_commit":"b52fdb9184b9d73d8e4b27a5ec3e44e2980898b9"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milwad-dev%2Flaravel-validate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milwad-dev%2Flaravel-validate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milwad-dev%2Flaravel-validate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milwad-dev%2Flaravel-validate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milwad-dev","download_url":"https://codeload.github.com/milwad-dev/laravel-validate/tar.gz/refs/heads/1.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247829511,"owners_count":21002997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["advance-validation","larave-package","laravel","laravel-eloquent-validation","laravel-rule","laravel-validate","laravel-validate-package","laravel-validate-rule","laravel-validation","laravel-validation-library","localization","php","rule","validate","validation","validation-rule"],"created_at":"2024-10-11T11:09:55.198Z","updated_at":"2025-04-08T11:12:29.690Z","avatar_url":"https://github.com/milwad-dev.png","language":"PHP","readme":"# Laravel Validate\n\n\u003cimg src=\"https://banners.beyondco.de/Laravel%20Validate.png?theme=dark\u0026packageManager=composer+require\u0026packageName=milwad%2Flaravel-validate\u0026pattern=circuitBoard\u0026style=style_1\u0026description=Help+to+write+easy+%26+faster+advance+validation+for+Laravel\u0026md=1\u0026showWatermark=1\u0026fontSize=100px\u0026images=https%3A%2F%2Flaravel.com%2Fimg%2Flogomark.min.svg\" alt=\"laravel-validate-banner\"\u003e\n\n[![PHP Version Require](https://img.shields.io/packagist/dependency-v/milwad/laravel-validate/php)](https://packagist.org/packages/milwad/laravel-validate)\n[![Latest Stable Version](https://img.shields.io/packagist/v/milwad/laravel-validate.svg?style=flat-square)](https://packagist.org/packages/milwad/laravel-validate)\n[![Total Downloads](https://img.shields.io/packagist/dt/milwad/laravel-validate.svg?style=flat-square)](https://packagist.org/packages/milwad/laravel-validate)\n[![License](https://img.shields.io/packagist/l/milwad/laravel-validate)](https://packagist.org/packages/milwad/laravel-validate)\n[![Passed Tests](https://github.com/milwad-dev/laravel-validate/actions/workflows/run-tests.yml/badge.svg)](https://github.com/milwad-dev/laravel-validate/actions/workflows/run-tests.yml)\n[![Quality Score](https://img.shields.io/scrutinizer/g/milwad-dev/laravel-validate.svg?style=flat-square)](https://scrutinizer-ci.com/g/milwad-dev/laravel-validate)\n[![Check Imports](https://github.com/milwad-dev/laravel-validate/actions/workflows/imports.yml/badge.svg?branch=1.x)](https://github.com/milwad-dev/laravel-validate/actions/workflows/imports.yml)\n\n***\nThe `Laravel-Validate` package enhanced Laravel validation capabilities with custom rules and methods for simplified and efficient validation\nlogic. \u003cbr\u003e\nYou can validate data more easily, `Laravel Validate` has lots of rule classes for validation. \u003cbr\u003e\nThis package supports localization and can be used for most of the languages. \u003cbr\u003e\n(If some language didn't support, you can \u003ca href=\"https://github.com/milwad-dev/laravel-validate/pulls\"\u003ePR\u003c/a\u003e for new language)\n\n# Requirements\n\n***\n\n- ```PHP \u003e= 8.0```\n- ```Laravel \u003e= 9.0```\n\n| GitHub | L6                 | L7                 | L8                 | L9                 | L10                | L11                | L12                |\n|--------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|\n| 1.5    | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x:                | :x:                | :x:                |\n| 1.6    | :x:                | :x:                | :x:                | :white_check_mark: | :white_check_mark: | :x:                | :x:                |\n| 1.7    | :x:                | :x:                | :x:                | :white_check_mark: | :white_check_mark: | :x:                | :x:                |\n| 1.8    | :x:                | :x:                | :x:                | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x:                |\n| 1.9    | :x:                | :x:                | :x:                | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n\n# Installation\n\nYou can install the package with Composer.\n\n```bash\ncomposer require milwad/laravel-validate\n```\n\n# Publish\n\nIf you want to publish config file, you can run below command on your terminal:\n\n```shell\nphp artisan vendor:publish --tag=\"laravel-validate-config\"\n```\n\nIf you want to publish a lang file for a custom validation message you can run this command in the terminal:\n\n```shell\nphp artisan vendor:publish --tag=\"validate-lang-{$lang}\"\n```\n\nYou can replace `$lang` with your language name, for example:\n\n```shell\nphp artisan vendor:publish --tag=\"validate-lang-en\"\n```\n\nYou can see the [Support Languages](#support-languages) section if you don't know the language's name.\n\n# Configurations\n\nIf you may use rules with string like `ValidPhone`, you need to change the config option to `true`:\n\n```php\n/*\n * If you want to use rules like 'required|ValidPhone' in your validations, you can change it to true.\n */\n'using_container' =\u003e false,\n```\n\nIf `using_container` is set to true, you might have rules like this:\n\n```php\n'phone_number' =\u003e 'required|ValidPhone',\n```\n\nAnd `ValidPhone` would be a class that is resolved via the service container to check the validity of the phone number.\n\n# Usage\n\nYou can use `Laravel-Validate Rules` very simply. You can use the `new` keyword before the rule name.\n\n```php\nuse Milwad\\LaravelValidate\\Rules\\ValidPhoneNumber;\n\nreturn [\n    'phone' =\u003e ['required', new ValidPhoneNumber()],\n];\n```\n\n# Rules\n\n| #  | Rule name                                                                                                                        | Usage                                                                                                                                                                                             |\n|----|----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1  | [ValidBase64](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-base64.md)                                  | Validate base64 for ex (bWlsd2Fk)                                                                                                                                                                 |\n| 2  | [ValidBitcoinAddress](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-bitcoin-address.md)                 | Validate bitcoin address for ex (1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY)                                                                                                                              |\n| 3  | [ValidCamelCase](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-camel-case.md)                           | Validate camel case for ex (milwadDev)                                                                                                                                                            |\n| 4  | [ValidCapitalCharWithNumber](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-capital-char-with-number.md) | Validate String for ex (MILWAD-84)                                                                                                                                                                |\n| 5  | [ValidCarNumber](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-car-number.md)                           | Validate car number for ex (KA01AB1234)                                                                                                                                                           |\n| 6  | [ValidCartNumberIran](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-cart-number-iran.md)                | Validate cart number for ex (1234123412341234)                                                                                                                                                    |\n| 7  | [ValidCountry](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-country.md)                                | Validate country name for ex (United Arab Emirates)                                                                                                                                               |\n| 8  | [ValidCreditCard](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-credit-card.md)                         | Validate credit card for ex (4111111111111111)                                                                                                                                                    |\n| 9  | [ValidDiscordUsername](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-discord-username.md)               | Validate username discord for ex (Milwad#2134)                                                                                                                                                    |\n| 10 | [ValidDomain](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-domain.md)                                  | Validate domain name for ex (github.com)                                                                                                                                                          |\n| 11 | [ValidDuplicate](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-duplicate.md)                            | Validate duplicate string, numbers for ex (1123456)                                                                                                                                               |\n| 12 | [ValidDuplicateCharacter](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-duplicate-character.md)         | Validate duplicate characters for ex (1,2,3,4,5,6,7,8,9)                                                                                                                                          |\n| 13 | [ValidEvenNumber](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-even-number.md)                         | Validate number is even for ex (1024)                                                                                                                                                             |\n| 14 | [ValidHashtag](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-hashtag.md)                                | Validate hashtag for ex (#milwad)                                                                                                                                                                 |\n| 15 | [ValidHexColor](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-hex-color.md)                             | Validate hex color for ex (#fcba03)                                                                                                                                                               |\n| 16 | [ValidHtmlTag](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-html-tag.md)                               | Validate html tags for ex (`\u003ch1\u003e\u003c/h1\u003e`)                                                                                                                                                           |\n| 17 | [ValidIban](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-iban.md)                                      | Validate IBAN ex (IR062960000000100324200001)                                                                                                                                                     |\n| 18 | [ValidImei](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-imei.md)                                      | Validate imei phone for ex (354809104295874)                                                                                                                                                      |\n| 19 | [ValidIpAddressIPV4](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-ip-address-ipv4.md)                  | Validate ip address IPV4 for ex (129.144.50.56)                                                                                                                                                   |\n| 20 | [ValidIpAddressIPV6](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-ip-address-ipv6.md)                  | Validate ip address IPV6 for ex (2001:db8:3333:4444:5555:6666:7777:8888)                                                                                                                          |\n| 21 | [ValidIranPostalCode](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-iran-postal-code.md)                | Validate Iran postal code ex (3354355599)                                                                                                                                                         |\n| 22 | [ValidJalaliDate](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-jalali-date.md)                         | Validate jalali date for ex (1384/8/25)                                                                                                                                                           |\n| 23 | [ValidJwt](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-jwt.md)                                        | Validate jwt for ex (eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJhZG1pbiI6dHJ1ZSwiZXhwIjoxNTgyNjE2MDA1fQ.umEYVDP_kZJGCI3tkU9dmq7CIumEU8Zvftc-klp-334) |\n| 24 | [ValidKebabCase](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-kebab-case.md)                           | Validate kebab case for ex (milwad-dev)                                                                                                                                                           |\n| 25 | [ValidNameDaysWeek](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-name-days-week.md)                    | Validate day week for ex (monday)                                                                                                                                                                 |\n| 26 | [ValidNationalCard](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-national-card.md)                     | Validate national card for ex (015016437)                                                                                                                                                         |\n| 27 | [ValidOddNumber](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-odd-number.md)                           | Validate number is odd for ex (4321)                                                                                                                                                              |\n| 28 | [ValidPascalCase](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-pascal-case.md)                         | Validate pascal case for ex (MilwadDev)                                                                                                                                                           |\n| 29 | [ValidPattern](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-pattern.md)                                | Validate texts with specific pattern 🔥 for ex (4444-4444-4444)                                                                                                                                   |\n| 30 | [ValidPhoneNumber](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-phone-number.md)                       | Validate phone number for ex (09366000000)                                                                                                                                                        |\n| 31 | [ValidPort](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-port.md)                                      | Validate port value for ex (8080)                                                                                                                                                                 |\n| 32 | [ValidSlashEndOfString](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-slash-end-of-string.md)           | Validate write slash at the string for ex (milwad/)                                                                                                                                               |\n| 33 | [ValidSlug](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-slug.md)                                      | Validate slug for ex (milwad-dev)                                                                                                                                                                 |\n| 34 | [ValidSnakeCase](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-snake-case.md)                           | Validate snake case for ex (milwad_dev)                                                                                                                                                           |\n| 35 | [ValidStrongPassword](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-strong-password.md)                 | Validate password for ex (Milwad123!)                                                                                                                                                             |\n| 36 | [ValidUlid](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-ulid.md)                                      | Validate ulid for ex (01ARZ3NDEKTSV4RRFFQ69G5FAV)                                                                                                                                                 |\n| 37 | [ValidUrl](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-url.md)                                        | Validate url for ex (https://www.google.com)                                                                                                                                                      |\n| 38 | [ValidUsername](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-username.md)                              | Validate username for ex (milwad)                                                                                                                                                                 |\n| 39 | [ValidUuid](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-uuid.md)                                      | Validate uuid for ex (123e4567-e89b-12d3-a456-426655440000)                                                                                                                                       |\n| 40 | [ValidVatId](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-vatid.md)                                    | Validate european VAT ID ex (EL123456789123)                                                                                                                                                      |\n\n\u003ca name=\"support-languages\"\u003e\u003c/a\u003e\n\n# Support Languages\n\nIf a language is not supported, you can make \u003ca href=\"https://github.com/milwad-dev/laravel-validate/issues/new/choose\"\u003eissue\u003c/a\u003e to add it. \u003cbr\u003e\nAlso, you can make \u003ca href=\"https://github.com/milwad-dev/laravel-validate/pulls\"\u003ePR\u003c/a\u003e to add it.\n\n- [x] Arabic (ar)\n- [x] Azerbaijani (az)\n- [x] Bangla (bn)\n- [x] Catalan (ca)\n- [x] Dutch (nl)\n- [x] German (de)\n- [x] Greek (el)\n- [x] English (en)\n- [x] Spanish (es)\n- [x] Persian (fa)\n- [x] French (fr)\n- [x] Hindi (hi)\n- [x] Indonesian (id)\n- [x] Italian (It)\n- [x] Japanese (ja)\n- [x] Korean (ko)\n- [x] Kurdish Sorani (ku_so)\n- [x] Português Brasil (pt_BR)\n- [x] Russian (ru)\n- [x] Sinhala (si)\n- [x] Swedish (sv)\n- [x] Turkish (tr)\n- [x] Ukrainian (uk)\n- [x] Chinese (zh_CN)\n\n# Adding Custom Phone Country Validator\n\nIf you need to add a custom phone number validator for a specific country, follow the steps below.\n\n### 1. Create Your Custom Validator Class\n\nFirst, you need to create a custom validator class that implements the `Milwad\\LaravelValidate\\Utils\\CountryPhoneValidator` contract. This contract\nensures that your custom validator adheres to the required structure and functionality.\n\n```php\nnamespace App\\Validators;\n\nuse Milwad\\LaravelValidate\\Utils\\CountryPhoneValidator;\n\nclass CustomPhoneValidator implements CountryPhoneValidator\n{\n    /**\n     * Validate the phone number for the custom country.\n     */\n    public function validate(string $phoneNumber): bool\n    {\n        // Implement the phone number validation logic for your country\n        // Example: Check if the phone number matches a specific pattern\n        return preg_match('/^\\+1234\\d{10}$/', $phoneNumber);\n    }\n}\n```\n\n### 2. Add the Validator to the Configuration File\n\nOnce you've created the custom validator class, add it to the configuration file (`config/laravel-validate.php`) under the `'phone-country'` array.\n\nFor example, if you're adding a validator for the country `XY`:\n\n```php\n'phone-country' =\u003e [\n    // Existing validators...\n    'XY' =\u003e \\App\\Validators\\CustomPhoneValidator::class, // Custom country\n],\n```\n\nThis tells the system to use your custom validator for phone numbers from country `XY`.\n\n### 3. Validation Usage\n\nOnce your custom validator is set up, you can use it in your application like any other validator:\n\n```php\nreturn [\n    'phone_ir' =\u003e [new ValidPhoneNumber('XY')],\n];\n```\n\n# License\n\n* This package is created and modified by \u003ca href=\"https://github.com/milwad-dev\" target=\"_blank\"\u003eMilwad Khosravi\u003c/a\u003e for Laravel over more than 9 and\n  has been released under the MIT License.\n\n# Contributing\n\nThis project exists thanks to all the people who contribute. [CONTRIBUTING](https://github.com/milwad-dev/laravel-validate/graphs/contributors)\n\n\u003ca href=\"https://github.com/milwad-dev/laravel-validate/graphs/contributors\"\u003e\u003cimg src=\"https://opencollective.com/laravel-validate/contributors.svg?width=890\u0026button=false\" /\u003e\u003c/a\u003e\n\n# Security\n\nIf you've found a security bug, please email [milwad.dev@gmail.com](mailto:milwad.dev@gmail.com) instead of using the issue tracker.\n\n# Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=milwad-dev/laravel-validate\u0026type=Date)](https://star-history.com/#milwad-dev/laravel-validate\u0026Date)\n\n# Donate\n\nIf this package is helpful for you, you can buy a coffee for me :) ❤️\n\n- Iraninan Gateway: https://daramet.com/milwad_khosravi\n- Paypal Gateway: SOON\n- MetaMask Wallet: `0xf208a562c5a93DEf8450b656c3dbc1d0a53BDE58`\n","funding_links":["https://payping.ir/@milwad-dev"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilwad-dev%2Flaravel-validate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilwad-dev%2Flaravel-validate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilwad-dev%2Flaravel-validate/lists"}