File: select.php

package info (click to toggle)
php-laravel-prompts 0.1.25-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 712 kB
  • sloc: php: 5,928; xml: 14; makefile: 8
file content (47 lines) | stat: -rw-r--r-- 1,309 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php

use function Laravel\Prompts\select;

require __DIR__.'/../vendor/autoload.php';

$role = select(
    label: 'Where are you from?',
    options: [
        'argentina' => 'Argentina',
        'australia' => 'Australia',
        'belgium' => 'Belgium',
        'brazil' => 'Brazil',
        'canada' => 'Canada',
        'chile' => 'Chile',
        'china' => 'China',
        'colombia' => 'Colombia',
        'egypt' => 'Egypt',
        'france' => 'France',
        'germany' => 'Germany',
        'india' => 'India',
        'italy' => 'Italy',
        'japan' => 'Japan',
        'kenya' => 'Kenya',
        'mexico' => 'Mexico',
        'morocco' => 'Morocco',
        'nigeria' => 'Nigeria',
        'new-zealand' => 'New Zealand',
        'portugal' => 'Portugal',
        'south-africa' => 'South Africa',
        'south-korea' => 'South Korea',
        'spain' => 'Spain',
        'switzerland' => 'Switzerland',
        'united-kingdom' => 'United Kingdom',
        'united-states' => 'United States',
    ],
    default: 'france',
    validate: fn ($value) => match ($value) {
        'spain' => 'Spain is not available yet.',
        default => null
    },
    hint: 'The country will determine the currency and the timezone of the user.',
);

var_dump($role);

echo str_repeat(PHP_EOL, 5);