PHPackages                             macocci7/file-selector-prompt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. macocci7/file-selector-prompt

ActiveLibrary[File &amp; Storage](/categories/file-storage)

macocci7/file-selector-prompt
=============================

An Additional File Selector Prompt for your Laravel/Prompts Applications.

v0.1.5(3mo ago)41.7k↓68.9%MITPHPPHP ^8.2

Since Jun 2Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/macocci7/file-selector-prompt)[ Packagist](https://packagist.org/packages/macocci7/file-selector-prompt)[ RSS](/packages/macocci7-file-selector-prompt/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (6)Dependencies (12)Versions (9)Used By (0)

File Selector Prompt
====================

[](#file-selector-prompt)

An Additional File Selector Prompt for your [Laravel/Prompts](https://github.com/laravel/prompts) Application.

Feature
-------

[](#feature)

File Selector Prompt provides assistance in entering file paths `quickly` and `accurately` in interactive mode.

    2024-05-29.00-13-46.mp4    By using `fileselector()`, you can input the file path `quickly` and `accurately`.

This feature has been included into [Community Prompts](https://github.com/artisan-build/community-prompts).

Requirements
------------

[](#requirements)

- PHP 8.2 or later
- [Composer](https://getcomposer.org/)

Installation
------------

[](#installation)

```
composer require macocci7/file-selector-prompt
```

Available Functions
-------------------

[](#available-functions)

- [Macocci7\\FileSelectorPrompt\\fileselector](#fileselector)
- [Macocci7\\FileSelectorPrompt\\form](#form)

### File-selector

[](#file-selector)

The `fileselector` function can be used to provide auto-completion for possible choices.

This function lists the entries in the directory on the local file system that matches the input, as the options for suggest.

The user can still provide any answer, regardless of the auto-completion hints:

```
use function Macocci7\FileSelectorPrompt\fileselector;

$path = fileselector('Select a file to import.');
```

You may also include placeholder text, a default value, a required value, and an informational hint:

```
$path = fileselector(
    label: 'Select a file to import.',
    placeholder: 'E.g. ./vendor/autoload.php',
    default: '',
    required: 'The file path is required.',
    hint: 'Input the file path.',
);
```

If you would like to perform additional validation logic, you may pass a closure to the `validate` argument:

```
$path = fileselector(
    label: 'Select a file to import.',
    placeholder: 'E.g. ./vendor/autoload.php',
    hint: 'Input the file path.',
    validate: fn (string $value) => match (true) {
        !is_readable($value) => 'Cannot read the file.',
        default => null,
    },
);
```

Additionally, you may make changes to the input before it gets validated by passing a closure to the `transform` argument.

```
$path = fileselector(
    label: 'Select a file to import.',
    placeholder: 'E.g. ./vendor/autoload.php',
    hint: 'Input the file path.',
    validate: fn (string $value) => match (true) {
        !is_readable($value) => 'Cannot read the file.',
        default => null,
    },
    transform: fn ($value) => realpath($value),
);
```

Finally, if you would like to filter the files listed in the choices with the file extensions, you may pass an array to the `extensions` argument:

```
$path = fileselector(
    label: 'Select a file to import.',
    placeholder: 'E.g. ./vendor/autoload.php',
    hint: 'Input the file path.',
    validate: fn (string $value) => match (true) {
        !is_readable($value) => 'Cannot read the file.',
        default => null,
    },
    extensions: [
        '.json',
        '.php',
    ],
);
```

### Form

[](#form)

`Macocci7\FileSelectorPrompt\form` function wraps `Laravel\Prompt\form` and supports `fileselector`.

```
use function Macocci7\FileSelectorPrompt\form;

$responses = form()
    ->fileselector(
        label: 'Select a file to import.',
        placeholder: 'E.g. ./vendor/autoload.php',
        hint: 'Input the file path.',
        validate: fn (string $value) => match (true) {
            !is_readable($value) => 'Cannot read the file.',
            default => null,
        },
        extensions: [
            '.json',
            '.php',
        ],
    )->submit();
```

License
-------

[](#license)

[MIT license](LICENSE.md)

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance80

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~131 days

Recently: every ~163 days

Total

6

Last Release

107d ago

PHP version history (2 changes)v0.1.0PHP ^8.1

v0.1.3PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/679ca12d13bd605020204915c2b8790bab7598a987b33bc9f4bcf7c7683d198c?d=identicon)[macocci7](/maintainers/macocci7)

---

Top Contributors

[![macocci7](https://avatars.githubusercontent.com/u/19181121?v=4)](https://github.com/macocci7 "macocci7 (26 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/macocci7-file-selector-prompt/health.svg)

```
[![Health](https://phpackages.com/badges/macocci7-file-selector-prompt/health.svg)](https://phpackages.com/packages/macocci7-file-selector-prompt)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[livewire/livewire

A front-end framework for Laravel.

23.6k89.0M2.7k](/packages/livewire-livewire)[laravel/octane

Supercharge your Laravel application's performance.

4.0k26.6M223](/packages/laravel-octane)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M992](/packages/statamic-cms)[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k60.6M803](/packages/drush-drush)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.5k21.5M601](/packages/laravel-boost)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
