GithubHelp home page GithubHelp logo

hrk-ir / laravel-validate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from milwad-dev/laravel-validate

0.0 0.0 0.0 86 KB

Help to write easy & faster advance validation for Laravel

License: MIT License

PHP 100.00%

laravel-validate's Introduction

Laravel validate

Latest Stable Version Total Downloads License PHP Version Require


Laravel validate is a package for validate faster & easier.
You can validate data easier, Laravel validate have lots of rule class for validation.
This package support localization and you can use for most of the language (if some language didn't support you can merge request for new language)

Requirements


  • PHP >= 8.0
  • Laravel >= 9.0
  • Morilog-Jalali >= 3.x

Installation


composer require milwad/laravel-validate

Usage

use Milwad\LaravelValidate\Rules\ValidPhoneNumber;

return [
    'phone' => ['required', new ValidPhoneNumber()],
];

Publish

If you want to publish lang file for custom validation message you can run this command in terminal.

php artisan vendor:publish

After you can see some option with start validate-lang, you can select which of this option with select lang for ex: laravel-lang-en.

Rules

# Rule name Usage
1 ValidBitcoinAddress Validate bitcoin address for ex (1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY)
2 ValidCapitalCharWithNumber Validate String for ex (MILWAD-84)
3 ValidDiscordUsername Validate username discord for ex (Milwad#2134)
4 ValidHashtag Validate hashtag for ex (#milwad)
5 ValidIpAddressIPV4 Validate ip address IPV4 for ex (129.144.50.56)
6 ValidIpAddressIPV6 Validate ip address IPV6 for ex (2001:db8:3333:4444:5555:6666:7777:8888)
7 ValidPhoneNumber Validate phone number for ex (09366000000)
8 ValidPort Validate port value for ex (8080)
9 ValidSlug Validate slug for ex (milwad-dev)
10 ValidImei Validate imei phone for ex (354809104295874)
11 ValidStrongPassword Validate password for ex (Milwad123!)
12 ValidUrl Validate url for ex (https://www.google.com)
13 ValidUsername Validate username for ex (milwad)
14 ValidUuid Validate uuid for ex (123e4567-e89b-12d3-a456-426655440000)
15 ValidHexColor Validate hex color for ex (#fcba03)
16 ValidHtmlTag Validate html tags for ex (<h1></h1>)
17 ValidNationalCard Validate national card for ex (015016437)
18 ValidCarNumber Validate car number for ex (KA01AB1234)
19 ValidNameDaysWeek Validate day week for ex (monday)
20 ValidEvenNumber Validate number is even for ex (1024)
21 ValidOddNumber Validate number is odd for ex (4321)
22 ValidSlashEndOfString Validate write slash at the string for ex (milwad/)
23 ValidCartNumberIran Validate cart number for ex (1234123412341234)
24 ValidBase64 Validate base64 for ex (bWlsd2Fk)
25 ValidJwt Validate jwt
26 ValidJalaliDate Validate jajali date for ex (1384/8/25)
27 ValidDuplicateCharacter Validate duplicate characters for ex (1,2,3,4,5,6,7,8,9)
28 ValidPattern Validate texts with specific pattern ๐Ÿ”ฅ for ex (4444-4444-4444)
29 ValidDuplicate Validate duplicate string, numbers for ex (1123456)
30 ValidUlid Validate ulid for ex (01ARZ3NDEKTSV4RRFFQ69G5FAV)

Rules

ValidPattern

Sometimes you need to validate text with pattern, For example you want to validate a text like (4444-4444-4444). If you want to check the length of text is seperator after - is 4, You can use this Rule:

use Milwad\LaravelValidate\Rules\ValidPattern;

return [
    'numbers' => ['required', new ValidPattern(4, '-')],
];

License

  • This package is created and modified by Milwad Khosravi for Laravel upper more than 8 and is released under the MIT License.

Contributing

This project exists thanks to all the people who contribute. CONTRIBUTING

Security

If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.