PHPackages                             jsiebach/commander - 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. [CLI &amp; Console](/categories/cli)
4. /
5. jsiebach/commander

ActiveLibrary[CLI &amp; Console](/categories/cli)

jsiebach/commander
==================

A Laravel Backpack-driven interface for executing artisan commands

162791[1 issues](https://github.com/jsiebach/commander/issues)PHP

Since Dec 13Pushed 7y ago3 watchersCompare

[ Source](https://github.com/jsiebach/commander)[ Packagist](https://packagist.org/packages/jsiebach/commander)[ RSS](/packages/jsiebach-commander/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)DependenciesVersions (1)Used By (0)

Backpack for Laravel Commander
==============================

[](#backpack-for-laravel-commander)

Backpack Commander is a simple CRUD interface for running Artisan commands in Backpack for Laravel. The main benefit is to quickly allow non-developers to run Artisan commands without needing command line access, and to easily configure the arguments and options for the command line using Backpack field definitions.

[![Commands CRUD](https://camo.githubusercontent.com/e30b6152cd294d26580760ff8b8d36652a7a89f09817ba2825b2888f8a886ae4/68747470733a2f2f64337676366c703535716a6171632e636c6f756466726f6e742e6e65742f6974656d732f3170315530343071306b305532323233315131792f53637265656e25323053686f74253230323031372d31322d3132253230617425323030392e32352e30362e706e673f582d436c6f75644170702d56697369746f722d49643d623036613663313863343861316637616139393965646262366561376133336126763d3062663139323832)](https://camo.githubusercontent.com/e30b6152cd294d26580760ff8b8d36652a7a89f09817ba2825b2888f8a886ae4/68747470733a2f2f64337676366c703535716a6171632e636c6f756466726f6e742e6e65742f6974656d732f3170315530343071306b305532323233315131792f53637265656e25323053686f74253230323031372d31322d3132253230617425323030392e32352e30362e706e673f582d436c6f75644170702d56697369746f722d49643d623036613663313863343861316637616139393965646262366561376133336126763d3062663139323832)[![Running a command using Backpack for Laravel Commander](https://camo.githubusercontent.com/f32d6e23032b2b166e23ffa654c9a335d07273f0185c1ed417c7848cad1ebe8b/68747470733a2f2f64337676366c703535716a6171632e636c6f756466726f6e742e6e65742f6974656d732f33633032337a3243334332773068336e3341314a2f53637265656e25323053686f74253230323031372d31322d3132253230617425323030392e32352e32302e706e673f582d436c6f75644170702d56697369746f722d49643d623036613663313863343861316637616139393965646262366561376133336126763d6164613031353536)](https://camo.githubusercontent.com/f32d6e23032b2b166e23ffa654c9a335d07273f0185c1ed417c7848cad1ebe8b/68747470733a2f2f64337676366c703535716a6171632e636c6f756466726f6e742e6e65742f6974656d732f33633032337a3243334332773068336e3341314a2f53637265656e25323053686f74253230323031372d31322d3132253230617425323030392e32352e32302e706e673f582d436c6f75644170702d56697369746f722d49643d623036613663313863343861316637616139393965646262366561376133336126763d6164613031353536)

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

[](#installation)

- Install [Backpack for Laravel](https://laravel-backpack.readme.io/docs)
- Install Backpack Commander

`composer require jsiebach/commander`

- Publish the config file

`php artisan vendor:publish --provider="JSiebach\Commander\CommanderServiceProvider" --tag="config"`

- Publish the migration

`php artisan vendor:publish --provider="JSiebach\Commander\CommanderServiceProvider" --tag="migrations"`

- Review the config file to update configuration for your app. Available options are:

`route`: Edit the route for the commander interface. Defaults to `/admin/commander/command`.

`allow_creation_and_deletion`: Determine whether new commands can be added or deleted. It is recommended to keep this option `false` in a production environment and add new commands directly in the database.

- Run `php artisan migrate`
- Add your commands interface link to the sidebar (Optional)

` Commands`

Adding commands to Commander
----------------------------

[](#adding-commands-to-commander)

You can now add new commands to your `commander_commands` table. The fields are:

`command`: The artisan command (ie. `inspire` - whatever you would fill in for `php artisan XXXXX`)

`descriptive_name`: A name to show users for the command. Will default to the artisan command name

The CRUD interface will also show a column with the `description` property of the command.

Defining commands
-----------------

[](#defining-commands)

To define a command, add a function to the command called `getCommanderFields()`, which should return an array of Backpack field definitions.

- For simple commands like `inspire`, you can leave off the `getCommanderFields()` function entirely.
- For commands that take arguments and options, you should return the Backpack field configuration in the `getCommanderFields()` function on the command. For example:

```
