Download the PHP package roshan-dhungana/route-commands without Composer

On this page you can find all versions of the php package roshan-dhungana/route-commands. 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 route-commands

��# Laravel Route Commands

A beautiful browser-based Artisan command runner for Laravel.

Laravel Route Commands provides a web interface for executing Laravel Artisan commands directly from your browser.

Instead of opening a terminal every time you need to run a common command such as:

`bash

php artisan cache:clear

php artisan route:list

php artisan config:clear

php artisan migrate

`

you can open the Route Commands dashboard and execute permitted commands from a modern glass-style interface.

> Important: Because this package executes Artisan commands, it should only be exposed to trusted and authenticated users. Production installations should also use the command allowlist.

---

## Features

* �& Execute Laravel Artisan commands from your browser

* <ب� Modern glassmorphism interface

* =؀� One-click execution for predefined commands

* =إ�� Terminal-style command output

* =��� Copy command output

* >��� Clear terminal output

* =���� Execute custom permitted Artisan commands

* >��� Support for Artisan arguments and options

* =�� Built-in Laravel authentication

* =�d� Uses the host application's existing users/authentication system

* =ت� Login and logout support

* =���� Configurable Artisan command allowlist

* =�� Protected dashboard and command execution routes

* =��� Easy Composer installation

* >��� Built using Laravel's Service Provider architecture

---

# Requirements

Before installing this package, make sure your application has:

* PHP 8.2+

* Laravel 10+

* Composer

The package supports Laravel 10, 11, 12, and 13, subject to the PHP requirements of the Laravel version being used.

The package is designed to work as a Laravel package and uses Laravel's package discovery mechanism.

---

# Installation

Install the package using Composer:

`bash

composer require roshan-dhungana/route-commands

`

Laravel should automatically discover the package service provider through Composer package discovery.

After installation, clear the Laravel application cache:

`bash

php artisan optimize:clear

`

Verify that the package routes are registered:

`bash

php artisan route:list --path=route-commands

`

---

# Authentication

Starting with v1.1.0, Route Commands includes built-in authentication.

The package uses the host Laravel application's existing authentication system.

It does not create a separate users table.

By default, it uses Laravel's:

`text

web

`

authentication guard.

The authentication flow is:

`text

User

�!

/route-commands/login

�!

Laravel web authentication

�!

Existing application users table

�!

Authenticated session

�!

/route-commands

`

This means users can log in using the same credentials managed by the Laravel application.

---

# Authentication Configuration

The package configuration is located at:

`text

config/route-commands.php

`

The authentication configuration can be defined as:

`php

'auth' => [

'enabled' => true,

'guard' => 'web',

'middleware' => [

'web',

],

],

`

### Configuration options

| Option | Description |

| ------------ | ---------------------------------------------------- |

| enabled | Enables package authentication |

| guard | Laravel authentication guard to use |

| middleware | Middleware used by the package authentication routes |

The default guard is:

`php

'web'

`

If your Laravel application uses another appropriate session-based guard, you can configure it here.

For example:

`php

'auth' => [

'enabled' => true,

'guard' => 'admin',

'middleware' => [

'web',

],

],

`

The selected guard must already be configured by the host Laravel application.

---

# Login

When authentication is enabled, open:

`text

http://127.0.0.1:8000/route-commands/login

`

or:

`text

https://your-domain.com/route-commands/login

`

The package displays a login page.

After successful authentication, the user is redirected to:

`text

/route-commands

`

The login request uses Laravel's normal session-based authentication and CSRF protection.

---

# Logout

Authenticated users can log out using the package logout functionality.

The package:

1. Logs the user out through the configured guard.

2. Invalidates the session.

3. Regenerates the CSRF token.

4. Redirects the user back to the login page.

---

# Protected Routes

The package protects the command dashboard and command execution endpoints using authentication middleware.

The main routes are:

`text

GET /route-commands/login

POST /route-commands/login

GET /route-commands

POST /route-commands/run

POST /route-commands/logout

`

The protected routes require an authenticated session.

---

# Command Allowlist

Authentication alone is not sufficient protection for an Artisan command runner.

An authenticated user should not automatically be allowed to execute every Artisan command available in the Laravel application.

Route Commands therefore supports an allowed command list.

Configure permitted commands in:

`text

config/route-commands.php

`

Example:

`php

'allowed_commands' => [

'cache:clear',

'config:clear',

'route:clear',

'view:clear',

'event:clear',

'optimize:clear',

'about',

'route:list',

'migrate:status',

'schedule:list',

'migrate',

'storage:link',

'queue:restart',

'queue:failed',

'queue:flush',

],

`

Before executing a command, the package checks whether the requested command exists in the configured allowlist.

If the command is not allowed, the package returns:

`text

403 Forbidden

`

with:

`text

This command is not allowed.

`

This prevents authenticated users from simply submitting arbitrary Artisan commands.

---

# Security Recommendation

The Route Commands dashboard should be treated as an administrative interface.

Do not expose it publicly without authentication.

For production environments:

* Enable authentication.

* Use a trusted authentication guard.

* Configure a restrictive command allowlist.

* Avoid exposing destructive commands unnecessarily.

* Do not allow arbitrary command execution.

* Review every command added to the allowlist.

* Consider restricting access further using Laravel authorization, network controls, or a VPN.

For example, avoid exposing potentially destructive commands unless there is a specific operational requirement.

---

# Recommended Production Allowlist

A conservative production configuration could be:

`php

'allowed_commands' => [

'cache:clear',

'config:clear',

'route:clear',

'view:clear',

'about',

'route:list',

'migrate:status',

],

`

Commands that modify the database or filesystem should only be exposed when required.

For example:

`text

migrate

storage:link

queue:flush

`

should be reviewed carefully before being enabled.

---

# Using the Dashboard

After authentication, open:

`text

/route-commands

`

The dashboard contains predefined command cards.

For example:

`text

cache:clear

config:clear

route:clear

view:clear

event:clear

optimize:clear

`

Clicking a command card executes the command immediately, provided the command is included in the configured allowlist.

For example:

`text

cache:clear

`

is equivalent to:

`bash

php artisan cache:clear

`

---

# Inspection Commands

The dashboard can provide useful Laravel inspection commands such as:

`bash

php artisan about

`

`bash

php artisan route:list

`

`bash

php artisan migrate:status

`

`bash

php artisan schedule:list

`

The command output is displayed directly inside the browser terminal.

---

# Database Commands

Database-related commands can also be exposed when explicitly added to the allowlist.

For example:

`bash

php artisan migrate

`

and:

`bash

php artisan storage:link

`

Only add commands that your application's trusted users actually need.

Always understand the consequences of a command before adding it to the allowlist, especially commands that modify or delete data.

---

# Queue Commands

Queue-related commands can be exposed through the dashboard.

Examples:

`bash

php artisan queue:restart

`

`bash

php artisan queue:failed

`

`bash

php artisan queue:flush

`

Add only the required commands to:

`php

'allowed_commands' => [

// ...

],

`

---

# Custom Commands

The dashboard provides a custom command input.

For example:

`text

cache:clear

`

or:

`text

route:list

`

or:

`text

migrate:status

`

Enter the command and click:

`text

Execute Command

`

The command is executed only if it is included in the configured allowlist.

The output is then displayed in the terminal panel.

---

# Command Arguments and Options

The package supports passing Artisan arguments and options as JSON.

For example, Laravel's:

`bash

php artisan make:model Post --migration

`

can be represented as:

`text

command:

make:model

`

with:

`json

{

"name": "Post",

"--migration": true

}

`

Another example:

`bash

php artisan make:controller UserController

`

can be represented as:

`text

command:

make:controller

`

with:

`json

{

"name": "UserController"

}

`

The command itself must still be permitted by the configured command allowlist.

---

# How It Works

The package provides authentication and command execution routes.

## Login

`http

GET /route-commands/login

`

Displays the login page.

## Login Submission

`http

POST /route-commands/login

`

Authenticates the user using the configured Laravel guard.

## Dashboard

`http

GET /route-commands

`

Displays the command runner interface.

This route requires authentication.

## Execute Command

`http

POST /route-commands/run

`

The request contains:

`text

command

options

`

Example:

`text

command=route:list

options=

`

The package first verifies that the user is authenticated and that the requested command is allowed.

It then internally executes:

`php

Artisan::call($command, $parameters);

`

The Artisan output is returned as plain text.

The frontend reads the response using:

`javascript

const responseText = await response.text();

`

rather than:

`javascript

const data = await response.json();

`

This is intentional because Artisan commands such as route:list generate terminal-style text output rather than JSON.

---

# Architecture

The package follows a simple Laravel package structure:

`text

route-commands/

%

%%% config/

% %%% route-commands.php

%

%%% resources/

% %%% views/

% %%% auth/

% % %%% login.blade.php

% %%% index.blade.php

%

%%% src/

% %

% %%% Console/

% %

% %%% Http/

% % %%% Controllers/

% % % %%% AuthController.php

% % % %%% CommandController.php

% % %

% % %%% Middleware/

% % %%% RouteCommandsAuthenticate.php

% %

% %%% Services/

% % %%% CommandExecutor.php

% %

% %%% routes/

% % %%% web.php

% %

% %%% RouteCommandsServiceProvider.php

%

%%% composer.json

%%% README.md

`

---

# Service Provider

The package service provider registers the package resources.

`php

<?php

namespace RoshanDhungana\RouteCommands;

use Illuminate\Support\ServiceProvider;

class RouteCommandsServiceProvider extends ServiceProvider

{

public function register(): void

{

$this->mergeConfigFrom(

DIR . '/../config/route-commands.php',

'route-commands'

);

}

public function boot(): void

{

$this->loadRoutesFrom(

DIR . '/routes/web.php'

);

$this->loadViewsFrom(

DIR . '/../resources/views',

'route-commands'

);

$this->publishes([

DIR . '/../config/route-commands.php'

=> config_path('route-commands.php'),

], 'route-commands-config');

}

}

`

Laravel package service providers are the standard integration point for registering package resources such as:

* Configuration

* Routes

* Views

* Service bindings

* Publishable assets

---

# Configuration Publishing

The package configuration can be published into the host Laravel application.

Run:

`bash

php artisan vendor:publish --tag=route-commands-config

`

This publishes:

`text

config/route-commands.php

`

into the application's:

`text

config/

`

directory.

After changing the configuration, clear Laravel's cached configuration:

`bash

php artisan optimize:clear

`

---

# Routes

The package registers authentication and protected command routes.

Conceptually:

`php

Route::middleware(['web'])

->prefix('route-commands')

->group(function () {

Route::get('/login', [

AuthController::class,

'showLogin',

])->name('route-commands.login');

Route::post('/login', [

AuthController::class,

'login',

])->name('route-commands.login.submit');

});

`

Protected routes use the package authentication middleware:

`php

Route::middleware([

'web',

RouteCommandsAuthenticate::class,

])

->prefix('route-commands')

->group(function () {

Route::get('/', [

CommandController::class,

'index',

])->name('route-commands.index');

Route::post('/run', [

CommandController::class,

'run',

])->name('route-commands.run');

Route::post('/logout', [

AuthController::class,

'logout',

])->name('route-commands.logout');

});

`

---

# Development

Clone the repository:

`bash

git clone https://github.com/dhunganaroshan341/Route-Commands-Composer.git

`

Enter the directory:

`bash

cd Route-Commands-Composer

`

Install dependencies:

`bash

composer install

`

---

# Local Package Development

If you are developing Route Commands alongside another Laravel application, Composer's path repository feature can be used.

Example:

`json

{

"repositories": [

{

"type": "path",

"url": "../route-commands",

"options": {

"symlink": true

}

}

]

}

`

Then require the development version:

`bash

composer require roshan-dhungana/route-commands:@dev

`

With symlink enabled, changes made to the local package are immediately available to the Laravel application.

After making package changes, it can be useful to run:

`bash

composer dump-autoload

`

and:

`bash

php artisan optimize:clear

`

---

# Testing the Package

After installing the package:

`bash

php artisan optimize:clear

`

Check the registered routes:

`bash

php artisan route:list --path=route-commands

`

You should see routes similar to:

`text

GET|HEAD route-commands/login

POST route-commands/login

GET|HEAD route-commands

POST route-commands/run

POST route-commands/logout

`

Open:

`text

http://127.0.0.1:8000/route-commands/login

`

Log in using an existing Laravel application user.

Then test permitted commands such as:

`text

cache:clear

`

`text

route:list

`

`text

about

`

Finally, test a command that is not in the allowlist.

It should return:

`text

403

`

with:

`text

This command is not allowed.

`

---

# Example Workflow

Install the package:

`bash

composer require roshan-dhungana/route-commands

`

Clear Laravel caches:

`bash

php artisan optimize:clear

`

Publish the configuration if customization is required:

`bash

php artisan vendor:publish --tag=route-commands-config

`

Configure authentication and allowed commands in:

`text

config/route-commands.php

`

Start Laravel:

`bash

php artisan serve

`

Open:

`text

http://127.0.0.1:8000/route-commands/login

`

Authenticate using an existing application user.

Then select a permitted command such as:

`text

Route List

`

The package executes:

`bash

php artisan route:list

`

and displays the result inside the browser terminal.

---

# Troubleshooting

## Route does not exist

Clear the application cache:

`bash

php artisan optimize:clear

`

Then regenerate Composer's autoloader:

`bash

composer dump-autoload

`

Verify:

`bash

php artisan route:list --path=route-commands

`

---

## Package service provider is not loaded

Check the package composer.json.

It should contain:

`json

{

"autoload": {

"psr-4": {

"RoshanDhungana\\RouteCommands\\": "src/"

}

},

"extra": {

"laravel": {

"providers": [

"RoshanDhungana\\RouteCommands\\RouteCommandsServiceProvider"

]

}

}

}

`

Then run:

`bash

composer dump-autoload

`

and:

`bash

php artisan optimize:clear

`

Laravel package discovery should then register the service provider automatically.

---

## Login returns 419 Page Expired

A 419 response generally indicates a session or CSRF issue in the host Laravel application.

Check that the application has a working Laravel session configuration.

For local development, for example:

`env

SESSION_DRIVER=file

SESSION_DOMAIN=

SESSIONSECURECOOKIE=false

SESSIONSAMESITE=lax

`

If using:

`env

SESSION_DRIVER=database

`

make sure the application's sessions table exists.

Also clear the configuration cache:

`bash

php artisan optimize:clear

`

Make sure you consistently use the same local hostname, for example:

`text

http://127.0.0.1:8000

`

rather than switching between:

`text

http://127.0.0.1:8000

`

and:

`text

http://localhost:8000

`

---

## Login page loads but authentication fails

Check the configured guard:

`php

'auth' => [

'enabled' => true,

'guard' => 'web',

],

`

The selected guard must exist in the host application's:

`text

config/auth.php

`

Also verify that the application already has valid users available to that guard.

---

## Command returns "This command is not allowed"

Check:

`text

config/route-commands.php

`

and verify that the command has been added to:

`php

'allowed_commands' => [

// permitted commands

],

`

For example:

`php

'allowed_commands' => [

'cache:clear',

'route:list',

'about',

],

`

Then clear configuration:

`bash

php artisan optimize:clear

`

---

## route:list Response Error

If the browser reports an error such as:

`text

Unexpected non-whitespace character after JSON

`

make sure the controller returns Artisan output as plain text:

`php

return response(

$output,

200

)->header(

'Content-Type',

'text/plain; charset=UTF-8'

);

`

The frontend should read the response using:

`javascript

const responseText = await response.text();

`

Do not use:

`javascript

const data = await response.json();

`

for Artisan command output.

---

# Security Model

The package uses two primary security layers:

`text

Route Commands

%

�%

Authentication

%

�%

Authenticated User

%

�%

Command Allowlist

%

%%%%%%%%4%%%%%%%%%

% %

Allowed Not Allowed

% %

�% �%

Artisan::call() 403

`

This is intentionally preferable to simply checking whether a user is logged in.

An authenticated user should only be able to execute commands that the application administrator has explicitly permitted.

---

# Versioning

Route Commands follows semantic versioning.

Example:

`text

v1.0.7

`

represents the previous stable release.

Authentication and command allowlisting are introduced in:

`text

v1.1.0

`

The package can therefore be upgraded using:

`bash

composer require roshan-dhungana/route-commands:^1.1

`

---

# Roadmap

Potential future improvements:

* [ ] Authorization / role-based command access

* [ ] Laravel Gate integration

* [ ] Command execution history

* [ ] Execution timestamps

* [ ] Execution duration

* [ ] Success/failure history

* [ ] Download command output

* [ ] Search commands

* [ ] Favorite commands

* [ ] Custom command groups

* [ ] Configurable dashboard

* [ ] Dark/light themes

* [ ] AJAX command execution

* [ ] Audit logging

* [ ] Per-command authorization

* [ ] Command execution restrictions by environment

---

# Contributing

Contributions are welcome.

Fork the repository, create a feature branch, make your changes, and submit a pull request.

Create a feature branch:

`bash

git checkout -b feature/my-feature

`

Make your changes and commit:

`bash

git add .

git commit -m "feat: add my feature"

`

Push the branch:

`bash

git push origin feature/my-feature

`

Then open a pull request.

---

# License

This package is open-sourced software licensed under the MIT license.

---

# Author

Roshan Dhungana

Laravel / PHP Developer

---

# Useful Links

* Laravel Documentation

* Laravel Package Development

* Composer

* Packagist

* GitHub Repository

---

# Summary

Laravel Route Commands provides a browser-based interface for running controlled Laravel Artisan commands.

The v1.1 architecture is:

`text

Laravel Application

%

�%

/route-commands/login

%

�%

Laravel Authentication

%

�%

Authenticated User

%

�%

/route-commands

%

�%

CommandController

%

�%

Command Allowlist

%

%%%%%4%%%%%%

% %

Allowed Denied

% %

�% �%

Command 403

Executor

%

�%

Artisan::call()

%

�%

Artisan Output

%

�%

Browser Terminal

`

The package is particularly useful for development, internal administration, and controlled server maintenance.

Because it provides access to Artisan command execution, installations should always use authentication and a restrictive command allowlist, especially in production environments.


All versions of route-commands with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
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 roshan-dhungana/route-commands contains the following files

Loading the files please wait ...