PHP code example of frostbitten / flexible-url

1. Go to this page and download the library: Download frostbitten/flexible-url library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

frostbitten / flexible-url example snippets


use Frostbitten\FlexibleUrl\FlexibleUrl;

public function rules(): array
{
    return [
        'website' => ['nullable', new FlexibleUrl],
    ];
}

new FlexibleUrl(function (string $attribute, string $normalizedValue) {
    // e.g. update a Livewire property
    $this->$attribute = $normalizedValue;
})