Download the PHP package christophrumpel/laravel-command-file-picker without Composer

On this page you can find all versions of the php package christophrumpel/laravel-command-file-picker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-command-file-picker

Laravel Command File Picker

Latest Version on Packagist Build Status Quality Score Total Downloads

This package lets you show a list of files or classes to choose from during a Laravel command.

Screenshot of the command Screenshot of the command Screenshot of the command

Reasons You Might Need This Package

While using Laravel commands, you may need to run them on specific files or classes. Let's say you want to run some actions on one of your Laravel models. In the past, you may have passed a class or file as an argument to the command. This works, but it is quite cumbersome and leads to typing mistakes.

This package will make it easy for the user by prompting a list of files or classes. (like in the screenshot above) The user can then easily select one, and you can use it inside your command.

Installation

You can install the package via composer:

Usage

Load Classes

To show the user a list of classes, you need to use the package's trait called PicksClasses. Just add it to one of your Laravel commands. (Be aware that you have to create your Laravel commands yourself.)

After that you are able to show the user a list of files to choose from by calling the new askToPickClasses method:

This will show the user all the classes and give you back a collection. This collection can contain the one chosen model or all of them if you have use the All option. If you just need Laravel models, you can also load them like:

It will automatically look for models under your app/Models path.

Load Files

To show the user a list of files, you need to use the package's trait called PicksFiles. Just add it to one of your Laravel commands.

After that you are able to show the user a list of files to choose from by calling the new askToPickFiles method. As a parameter you provide a directory path.

This will show the user all the files and give you back a collection. This collection can contain the chosen file or all of them if you haven chosen the All option.

Filter Loaded Files

Sometimes you do not want to show all found files or classes to the user. This is when you can use a filter callable to define what results to leave out. Here is an example.

The second param is the filter callable which gets passed to Laravel's collection filter method. It lets you loop over all files and define what to keep in the files list and what to leave out. In our example, the decision will be random. Take note that the $fileInfo variable will be an array with some details about the current file like path. In case of a model or class it will contain the class name and file path.

The filtered result will then be shown to user during the Laravel command.

Remove "All" option

If you want to remove the All option when showing a list, you can do so with an extra parameter:

Testing

Changelog

Please see CHANGELOG for more information about what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.


All versions of laravel-command-file-picker with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
illuminate/support Version ^8.0
laravel/framework Version ^8.0
nikic/php-parser Version ^4.3
mockery/mockery Version ^1.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package christophrumpel/laravel-command-file-picker contains the following files

Loading the files please wait ....