url.php
Table of Contents
Functions
- url() : string
- Generates the 'url[:scheme]' rule expression.
Functions
url()
Generates the 'url[:scheme]' rule expression.
url([null|array<string|int, mixed>|string $scheme = null ]) : string
The field under this rule must be a valid url format. The default is to validate the common format: any_scheme://.... You can specify specific URL schemes if you wish.
Example:
$validation = new Factory()->validate( $inputs ,
[
'random_url' => 'url' , // value can be `any_scheme://...`
'https_url' => 'url:http' , // value must be started with `https://`
'http_url' => 'url:http,https' , // value must be started with `http://` or `https://`
'ftp_url' => 'url:ftp' , // value must be started with `ftp://`
'custom_url' => 'url:custom', // value must be started with `custom://`
]);
Parameters
- $scheme : null|array<string|int, mixed>|string = null
-
The scheme(s) of the url to evaluates.