PHP code example of ibrostudio / laravel-prompts-path-select

1. Go to this page and download the library: Download ibrostudio/laravel-prompts-path-select 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/ */

    

ibrostudio / laravel-prompts-path-select example snippets


use function IBroStudio\PathSelectPrompt\pathselect;
 
$directory = pathselect('Select a directory');

$directory = pathselect(
    label: 'Select a directory',
    hint: 'Use right and left arrows to navigate in folders',
    

$directory = pathselect(
    label: 'Select a directory',
    root: base_path(),
);

$directory = pathselect(
    label: 'Select a directory',
    root: base_path(),
    default: base_path('vendor'),
);

$file = pathselect(
    label: 'Select a file',
    root: base_path(),
    target: 'file',
);

$file = pathselect(
    label: 'Select a JSON file',
    root: base_path(),
    target: '.json',
);

$responses = form()
    ->text('What is your name?', 'password' => 'min:8'])
    ->add(function () {
            return pathselect('Select a directory');
        }, name: 'directory')
    ->confirm('Do you accept the terms?')
    ->submit();