PHPackages                             mwguerra/web-terminal - 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. mwguerra/web-terminal

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

mwguerra/web-terminal
=====================

A web-based terminal component for Filament/Laravel with command whitelisting and multiple connection types

v2.2.0(2mo ago)251.1k↓16.7%6[1 issues](https://github.com/mwguerra/web-terminal/issues)MITPHPPHP ^8.2

Since Dec 16Pushed 2mo agoCompare

[ Source](https://github.com/mwguerra/web-terminal)[ Packagist](https://packagist.org/packages/mwguerra/web-terminal)[ Docs](https://github.com/mwguerra/web-terminal)[ RSS](/packages/mwguerra-web-terminal/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (22)Versions (14)Used By (0)

Web Terminal
============

[](#web-terminal)

A secure web terminal package for Laravel with Filament integration. Execute allowed commands on local systems or SSH servers.

Version Compatibility
---------------------

[](#version-compatibility)

VersionFilamentLaravelLivewirePHP2.x5.x12.x4.x8.2+1.x4.x11.x3.x8.2+Features
--------

[](#features)

- **Connection types**: Local shell execution or SSH connections to remote servers
- **Command whitelisting**: Configurable allowlist to restrict which commands can be executed
- **Scripts**: Define reusable command sequences with progress tracking and one-click execution
- **Comprehensive logging**: Audit trail for connections, commands, outputs, and errors
- **Multi-tenant support**: Built-in tenant isolation for SaaS applications
- **Session management**: Inactivity timeout, disconnect-on-navigate, and session statistics
- **Filament integration**: Terminal page and Terminal Logs resource with stats widgets
- **Embeddable**: Use as Livewire component or Filament Schema component in any page
- **Security by design**: Credential protection, input sanitization, rate limiting
- **Localization**: English and Portuguese (BR) translations included
- **Dark mode**: Full dark mode support via Filament

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

[](#requirements)

- PHP 8.2+
- Laravel 12.x
- Filament 5.x
- Livewire 4.x

> For Laravel 11 and Filament 4 support, use version `^1.0`.

> **Warning**
>
> This package provides real shell access to real servers. Commands executed through this terminal can modify files, change configurations, and affect running services.
>
> **Before using this package:**
>
> - Restrict access to technical personnel only — do not expose terminal pages to general users
> - Review and limit the allowed commands whitelist for each terminal instance
> - Enable logging to maintain an audit trail of all executed commands
> - Test configurations in a safe environment before deploying to production
>
> **Use at your own risk.** The authors are not responsible for any damage, data loss, or security incidents resulting from the use of this package. Always ensure proper access controls and review your security configuration.

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

[](#installation)

### For Filament 5 / Laravel 12 (latest)

[](#for-filament-5--laravel-12-latest)

```
composer require mwguerra/web-terminal:"^2.0"
```

### For Filament 4 / Laravel 11 (legacy)

[](#for-filament-4--laravel-11-legacy)

```
composer require mwguerra/web-terminal:"^1.0"
```

### Upgrading from v1.x to v2.x

[](#upgrading-from-v1x-to-v2x)

```
composer require mwguerra/web-terminal:"^2.0"
```

Key changes in v2.x:

- Requires Laravel 12.x, Filament 5.x, and Livewire 4.x
- If you published Blade views, update any `@entangle('prop')` to `$wire.entangle('prop')` in your custom views

### Interactive Setup

[](#interactive-setup)

Run the install command for guided configuration:

```
php artisan terminal:install
```

The installer will:

- Publish configuration file
- Publish database migration (with optional tenant support)
- Optionally publish Blade views for customization
- Optionally run the migration

#### Install Options

[](#install-options)

```
# Standard installation (interactive)
php artisan terminal:install

# Multi-tenant installation (adds tenant_id column)
php artisan terminal:install --with-tenant

# Standard installation (explicitly no tenant)
php artisan terminal:install --no-tenant

# Force overwrite existing files
php artisan terminal:install --force
```

#### Non-Interactive Installation

[](#non-interactive-installation)

Use `--no-interaction` (or `-n`) with specific flags to skip prompts:

```
# Install only config file
php artisan terminal:install --config -n

# Install only migration
php artisan terminal:install --migration -n

# Install config, migration, and run migrate
php artisan terminal:install --config --migration --migrate -n

# Install page only (requires --panel for multi-panel apps)
php artisan terminal:install --page --panel=admin -n

# Install everything non-interactively
php artisan terminal:install --config --migration --views --page --resource --migrate --panel=admin -n
```

FlagDescription`--config`Publish the configuration file`--migration`Publish the database migration`--views`Publish Blade views for customization`--migrate`Run migration after publishing`--page`Generate a custom Terminal page`--resource`Generate a custom TerminalLogs resource`--panel=`Specify the Filament panel (required for page/resource in multi-panel apps)**Note:** When using `-n` without any flags, the installer defaults to `--config --migration`.

#### Generate Custom Pages

[](#generate-custom-pages)

Generate customizable Terminal page and TerminalLogs resource in your application instead of using the plugin defaults:

```
# Generate a custom Terminal page
php artisan terminal:install --page

# Generate a custom TerminalLogs resource
php artisan terminal:install --resource

# Generate both page and resource
php artisan terminal:install --page --resource

# Generate for a specific panel (multi-panel apps)
php artisan terminal:install --page --panel=admin
```

The generated files are placed in directories configured in your panel provider via `->discoverPages()` and `->discoverResources()`. For example:

Generated FileLocationTerminal page`app/Filament/Pages/Terminal.php`TerminalLogResource`app/Filament/Resources/TerminalLogResource.php`ListTerminalLogs`app/Filament/Resources/TerminalLogResource/Pages/ListTerminalLogs.php`ViewTerminalLog`app/Filament/Resources/TerminalLogResource/Pages/ViewTerminalLog.php`> **Important:** When using custom generated pages with the plugin, you **must** disable the corresponding plugin defaults to avoid duplicate pages in your navigation.

```
// If you generated only the Terminal page
WebTerminalPlugin::make()
    ->withoutTerminalPage()

// If you generated only the TerminalLogs resource
WebTerminalPlugin::make()
    ->withoutTerminalLogs()

// If you generated both, disable both plugin defaults
WebTerminalPlugin::make()
    ->withoutTerminalPage()
    ->withoutTerminalLogs()

// Or use only() to keep plugin services without any default pages
WebTerminalPlugin::make()
    ->only([])
```

If you don't need the plugin at all (using only custom pages), you can remove `WebTerminalPlugin::make()` from your panel provider entirely.

#### Terminal Command Permissions

[](#terminal-command-permissions)

When generating a custom Terminal page, you can specify command permissions:

```
# Default - safe readonly commands (ls, pwd, cd, cat, grep, etc.)
php artisan terminal:install --page --allow-secure-commands

# Allow all commands (dangerous - use with caution)
php artisan terminal:install --page --allow-all-commands

# No commands - configure manually in the generated file
php artisan terminal:install --page --allow-no-commands
```

OptionGenerated ConfigurationDescription`--allow-secure-commands` (default)`->allowedCommands([...])`Safe readonly commands`--allow-all-commands``->allowAllCommands()`All commands allowed (dangerous)`--allow-no-commands``->allowedCommands([])`No commands (configure manually)#### Create Terminal Page Command

[](#create-terminal-page-command)

For more control over page generation, use the dedicated `terminal:make-page` command:

```
# Interactive mode - prompts for all options
php artisan terminal:make-page

# Create a page with a specific name
php artisan terminal:make-page ServerTerminal

# Specify panel and terminal key
php artisan terminal:make-page ServerTerminal --panel=admin --key=server-term

# Set command permissions
php artisan terminal:make-page AdminTerminal --allow-all-commands
php artisan terminal:make-page ViewerTerminal --allow-no-commands

# Non-interactive with defaults
php artisan terminal:make-page --no-interaction

# Overwrite existing file
php artisan terminal:make-page Terminal --force
```

OptionDescription`name`The page class name (default: `Terminal`)`--panel=`The Filament panel to create the page for`--key=`The terminal identifier key for logging`--allow-secure-commands`Safe readonly commands (default)`--allow-all-commands`All commands allowed (dangerous)`--allow-no-commands`No commands (configure manually)`--force`Overwrite existing file**Interactive prompts (when not using `--no-interaction`):**

1. **Panel selection** - if multiple panels exist
2. **Page class name** - defaults to "Terminal"
3. **Terminal key** - auto-generated from name (e.g., `server-terminal-terminal`)
4. **Command permissions** - secure/none/all options

### Manual Setup

[](#manual-setup)

If you prefer manual setup:

```
# Publish configuration
php artisan vendor:publish --tag=web-terminal-config

# Publish views (optional)
php artisan vendor:publish --tag=web-terminal-views
```

Quick Start
-----------

[](#quick-start)

Get a working terminal in under a minute:

```
// In your Filament PanelProvider
use MWGuerra\WebTerminal\WebTerminalPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            WebTerminalPlugin::make(),
        ]);
}
```

That's it! Visit `/admin/terminal` to access the terminal.

For a custom terminal with specific commands:

```
use MWGuerra\WebTerminal\Schemas\Components\WebTerminal;

WebTerminal::make()
    ->local()
    ->allowedCommands(['ls', 'pwd', 'cd', 'cat', 'git *'])
    ->workingDirectory(base_path())
    ->height('400px')
```

[![Local Terminal](https://raw.githubusercontent.com/mwguerra/web-terminal/main/docs/images/local-terminal.jpg)](https://raw.githubusercontent.com/mwguerra/web-terminal/main/docs/images/local-terminal.jpg)

Filament Integration
--------------------

[](#filament-integration)

The package provides a Filament plugin that adds:

- **Terminal Page**: A demo page with local terminal functionality
- **Terminal Logs Resource**: Browse and search terminal session logs with stats widgets

### Register the Plugin

[](#register-the-plugin)

Add the plugin to your Filament panel provider:

```
