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

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

srvkit/terminal
===============

A secure, framework-compatible PHP Web Terminal with autocomplete, suggestions, history, and a modern responsive dark theme UI.

10PHP

Since Jul 3Pushed 1mo agoCompare

[ Source](https://github.com/rahulsharmagg/srvkit-terminal)[ Packagist](https://packagist.org/packages/srvkit/terminal)[ RSS](/packages/srvkit-terminal/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Terminal Library
====================

[](#php-terminal-library)

A secure, framework-compatible, modern PHP Web Terminal library with rich features. Designed for easy drop-in integration into any PHP framework (Laravel, CodeIgniter 4, LeafPHP, etc.) or standalone PHP files.

Features
--------

[](#features)

- **Recent Command History**: Persisted in `localStorage` (survives tab/browser closures) and displayed dynamically in the sidebar.
- **Recent Command Suggestions**: Fish-shell/zsh style inline autocomplete suggestions based on both command history and common shell commands. Accepts suggestions via `Tab` or `Right Arrow`.
- **Terminal Help**: Built-in `help` command intercepts and displays keyboard shortcuts, available quick commands, and tips.
- **Password-Only Security**: Sleek, minimalist login interface requiring only a password.
- **Mobile Compatibility**: Responsively designed; on mobile viewports, the sidebar becomes a toggleable drawer sliding smoothly via CSS transition animations.
- **Clean SVG Icons**: Completely emoji-free layout using crisp, inline SVGs for high-performance and modern developer design aesthetics.

---

Standalone Usage
----------------

[](#standalone-usage)

```
// index.php
require_once 'src/Terminal.php';

$terminal = new \SrvKit\Terminal\Terminal([
    'password' => 'CS8854', // Your secure access password
]);

$terminal->handle();
```

---

Framework Integration Guides
----------------------------

[](#framework-integration-guides)

### 1. Laravel Integration

[](#1-laravel-integration)

#### Step 1: Install

[](#step-1-install)

Place the library files in your project (e.g. `app/Services/Terminal.php`) or install via local Composer path.

#### Step 2: Create a Controller

[](#step-2-create-a-controller)

Generate a controller or use a route closure:

```
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use SrvKit\Terminal\Terminal;

class TerminalController extends Controller
{
    public function index(Request $request)
    {
        $terminal = new Terminal([
            'password' => env('TERMINAL_PASSWORD', 'CS8854'),
        ]);

        // Hand over request handling to the library
        $terminal->handle();
    }
}
```

#### Step 3: Define Routes

[](#step-3-define-routes)

Define a match route that handles both `GET` (render page) and `POST` (auth/execute commands) in `routes/web.php`:

```
use App\Http\Controllers\TerminalController;

Route::match(['get', 'post'], '/terminal', [TerminalController::class, 'index']);
```

#### Step 4: Configure CSRF Protection

[](#step-4-configure-csrf-protection)

Since the terminal uses AJAX POST requests, you must exclude the terminal path from CSRF verification.

- **Laravel 11+** (`bootstrap/app.php`): ```
    $middleware->validateCsrfTokens(except: [
        '/terminal',
    ]);
    ```
- **Laravel 10 and below** (`app/Http/Middleware/VerifyCsrfToken.php`): ```
    protected $except = [
        '/terminal',
    ];
    ```

---

### 2. CodeIgniter 4 (CI4) Integration

[](#2-codeigniter-4-ci4-integration)

#### Step 1: Create a Controller

[](#step-1-create-a-controller)

Create a controller `app/Controllers/TerminalController.php`:

```
namespace App\Controllers;

use CodeIgniter\Controller;
use SrvKit\Terminal\Terminal;

class TerminalController extends Controller
{
    public function index()
    {
        $terminal = new Terminal([
            'password' => 'CS8854', // Or load from config/env
        ]);

        $terminal->handle();
    }
}
```

#### Step 2: Define Routes

[](#step-2-define-routes)

In `app/Config/Routes.php`, add:

```
$routes->match(['get', 'post'], 'terminal', '\App\Controllers\TerminalController::index');
```

#### Step 3: Configure CSRF Filter (If Enabled)

[](#step-3-configure-csrf-filter-if-enabled)

If you have global CSRF protection enabled in `app/Config/Filters.php`, make sure to exclude your terminal route:

```
public array $globals = [
    'before' => [
        'csrf' => ['except' => ['terminal']],
    ],
];
```

---

### 3. LeafPHP Integration

[](#3-leafphp-integration)

#### Step 1: Create Route

[](#step-1-create-route)

Define a route matching both GET and POST requests in your main file (e.g. `index.php`):

```
use SrvKit\Terminal\Terminal;

app()->match('/terminal', function () {
    $terminal = new Terminal([
        'password' => 'CS8854',
    ]);

    $terminal->handle();
});
```

---

Configuration Reference
-----------------------

[](#configuration-reference)

You can configure the terminal by passing an array of options to the constructor:

OptionTypeDefaultDescription`password``string``'CS8854'`Access password for login page`session_name``string``'php_terminal_session'`Name of the native PHP session cookie`session_prefix``string``'php_terminal_'`Prefix for storing variables in the session`cwd``string|null``null`Initial current working directory (e.g. project storage/root)`blocked_commands``array``['rm -rf /', 'mkfs', ...]`Blocked dangerous commands (case-insensitive)`allowed_commands``array|null``null`Array of allowed commands (if not null, only these are allowed)`quick_commands``array``['ls -la' => 'ls -la', ...]`Label-to-command mappings displayed in the sidebar### Setting Directory Programmatically

[](#setting-directory-programmatically)

You can also set or override the working directory programmatically before handling the request:

```
$terminal = new \SrvKit\Terminal\Terminal();
$terminal->setCwd('/path/to/your/custom/directory');
$terminal->handle();
```

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance60

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/09e79243df0a2cc8bd79e7b545031ee81f9d357ab197c6d46376f4ae4d5185f0?d=identicon)[srvkit](/maintainers/srvkit)

---

Top Contributors

[![rahulsharmagg](https://avatars.githubusercontent.com/u/36887105?v=4)](https://github.com/rahulsharmagg "rahulsharmagg (1 commits)")

### Embed Badge

![Health badge](/badges/srvkit-terminal/health.svg)

```
[![Health](https://phpackages.com/badges/srvkit-terminal/health.svg)](https://phpackages.com/packages/srvkit-terminal)
```

###  Alternatives

[illuminate/console

The Illuminate Console package.

13046.6M7.4k](/packages/illuminate-console)[styleci/cli

The CLI tool for StyleCI

71477.7k9](/packages/styleci-cli)[winbox/args

Windows command-line formatter

20722.5k21](/packages/winbox-args)

PHPackages © 2026

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