Skip to content

Commit 8f4fe07

Browse files
committed
Update README.md
1 parent 3abf601 commit 8f4fe07

File tree

1 file changed

+82
-174
lines changed

1 file changed

+82
-174
lines changed

README.md

Lines changed: 82 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -1,218 +1,126 @@
1-
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YNNLC9V28YDPN)
1+
# Laravel Terminal - Enhanced Version
22

3-
# Laravel Terminal
3+
Laravel 11/12 compatible web terminal with full Composer support and Filament authentication.
44

5-
[![StyleCI](https://styleci.io/repos/45892521/shield?style=flat)](https://styleci.io/repos/45892521)
6-
[![Build Status](https://travis-ci.org/recca0120/laravel-terminal.svg)](https://travis-ci.org/recca0120/laravel-terminal)
7-
[![Total Downloads](https://poser.pugx.org/recca0120/terminal/d/total.svg)](https://packagist.org/packages/recca0120/terminal)
8-
[![Latest Stable Version](https://poser.pugx.org/recca0120/terminal/v/stable.svg)](https://packagist.org/packages/recca0120/terminal)
9-
[![Latest Unstable Version](https://poser.pugx.org/recca0120/terminal/v/unstable.svg)](https://packagist.org/packages/recca0120/terminal)
10-
[![License](https://poser.pugx.org/recca0120/terminal/license.svg)](https://packagist.org/packages/recca0120/terminal)
11-
[![Monthly Downloads](https://poser.pugx.org/recca0120/terminal/d/monthly)](https://packagist.org/packages/recca0120/terminal)
12-
[![Daily Downloads](https://poser.pugx.org/recca0120/terminal/d/daily)](https://packagist.org/packages/recca0120/terminal)
13-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/recca0120/laravel-terminal/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/recca0120/laravel-terminal/?branch=master)
14-
[![Code Coverage](https://scrutinizer-ci.com/g/recca0120/laravel-terminal/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/recca0120/laravel-terminal/?branch=master)
5+
## Features
156

16-
## Installation
17-
18-
```bash
19-
composer require recca0120/terminal --dev
20-
```
21-
22-
OR
23-
24-
Add Presenter to your composer.json file:
25-
26-
```js
27-
"require-dev": {
28-
"recca0120/terminal": "^1.6.8"
29-
}
30-
```
31-
Now, run a composer update on the command line from the root of your project:
32-
33-
```
34-
composer update
35-
```
36-
37-
### Registering the Package
7+
- ✅ Laravel 11/12 compatibility
8+
- ✅ Full Composer support (all commands)
9+
- ✅ Smart Tinker with auto-fixes for quotes and namespaces
10+
- ✅ Filament authentication integration
11+
- ✅ Shared hosting compatible
12+
- ✅ No SSH required
3813

39-
Include the service provider within `app/config/app.php`. The service povider is needed for the generator artisan command.
40-
41-
```php
42-
'providers' => [
43-
...
44-
Recca0120\Terminal\TerminalServiceProvider::class,
45-
...
46-
];
47-
```
14+
## Installation
4815

49-
publish
16+
### 1. Install Package
5017

51-
```php
52-
artisan vendor:publish --provider="Recca0120\Terminal\TerminalServiceProvider"
18+
```bash
19+
composer config repositories.enhanced-terminal vcs https://github.com/megavolkan/laravel-terminal
20+
composer require recca0120/terminal:dev-master
5321
```
5422

23+
### 2. Publish Configuration
5524

56-
### URL
57-
58-
http://localhost/path/to/terminal
59-
60-
### config
61-
62-
```php
63-
return [
64-
'enabled' => env('APP_DEBUG'),
65-
'whitelists' => ['127.0.0.1', 'your ip'],
66-
'route' => [
67-
'prefix' => 'terminal',
68-
'as' => 'terminal.',
69-
// if you use laravel 5.1, remember to remove web middleware
70-
'middleware' => ['web'],
71-
// if you need auth, you need use web and auth middleware
72-
// 'middleware' => ['web', 'auth']
73-
],
74-
'commands' => [
75-
\Recca0120\Terminal\Console\Commands\Artisan::class,
76-
\Recca0120\Terminal\Console\Commands\ArtisanTinker::class,
77-
\Recca0120\Terminal\Console\Commands\Cleanup::class,
78-
\Recca0120\Terminal\Console\Commands\Find::class,
79-
\Recca0120\Terminal\Console\Commands\Mysql::class,
80-
\Recca0120\Terminal\Console\Commands\Tail::class,
81-
\Recca0120\Terminal\Console\Commands\Vi::class,
82-
// add your command
83-
],
84-
];
85-
25+
```bash
26+
php artisan vendor:publish --provider="Recca0120\Terminal\TerminalServiceProvider"
8627
```
8728

88-
## Available Commands
89-
90-
* artisan
91-
* artisan tinker
92-
* find
93-
* mysql
94-
* tail
95-
* vi
96-
97-
### Find
98-
99-
not full support, but you can delete file use this function (please check file permission)
29+
### 3. Create Filament Auth Middleware
10030

10131
```bash
102-
find ./vendor -name tests -type d -maxdepth 4 -delete
32+
php artisan make:middleware FilamentTerminalAuth
10333
```
10434

105-
## Add Your Command
35+
Add this content to `app/Http/Middleware/FilamentTerminalAuth.php`:
10636

107-
### Add Command Class
10837
```php
109-
// src/Console/Commands/Mysql.php
38+
<?php
11039

111-
namespace Recca0120\Terminal\Console\Commands;
40+
namespace App\Http\Middleware;
11241

113-
use Illuminate\Console\Command;
114-
use Illuminate\Foundation\Inspiring;
115-
use Recca0120\Terminal\Contracts\TerminalCommand;
42+
use Closure;
43+
use Illuminate\Http\Request;
44+
use Symfony\Component\HttpFoundation\Response;
11645

117-
class Inspire extends Command implements TerminalCommand
46+
class FilamentTerminalAuth
11847
{
119-
/**
120-
* The name and signature of the console command.
121-
*
122-
* @var string
123-
*/
124-
protected $signature = 'inspire';
125-
126-
/**
127-
* The console command description.
128-
*
129-
* @var string
130-
*/
131-
protected $description = 'Display an inspiring quote';
132-
133-
/**
134-
* Execute the console command.
135-
*
136-
* @return mixed
137-
*/
138-
public function handle()
48+
public function handle(Request $request, Closure $next): Response
13949
{
140-
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
50+
if (!auth()->check()) {
51+
return redirect('/admin/login');
52+
}
53+
54+
$user = auth()->user();
55+
56+
// Optional: Add role/permission checks
57+
/*
58+
if (!$user->hasRole('admin')) {
59+
return response('Access denied to terminal', 403);
60+
}
61+
*/
62+
63+
return $next($request);
14164
}
14265
}
14366
```
14467

145-
## ScreenShot
68+
### 4. Register Middleware
14669

147-
### Available Commands
148-
```bash
149-
$ help
150-
```
151-
![Available Commands](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/available-commands.png)
70+
In `bootstrap/app.php`, add:
15271

153-
### Artisan List
154-
```bash
155-
$ artisan
72+
```php
73+
->withMiddleware(function (Middleware $middleware) {
74+
$middleware->alias([
75+
'filament.terminal' => \App\Http\Middleware\FilamentTerminalAuth::class,
76+
]);
77+
})
15678
```
157-
![Artisan List](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/artisan-list.png)
15879

159-
### Migrate
160-
```bash
161-
$ artisan migrate --seed
162-
```
163-
![Migrate](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/artisan-migrate.png)
80+
### 5. Update Terminal Config
16481

165-
### Artisan Tinker
166-
```bash
167-
$ artisan tinker
82+
In `config/terminal.php`, set:
83+
84+
```php
85+
'route' => [
86+
'prefix' => 'terminal',
87+
'as' => 'terminal.',
88+
'middleware' => ['web', 'filament.terminal'],
89+
],
16890
```
169-
![Tinker](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/artisan-tinker.png)
17091

171-
### MySQL
172-
```bash
173-
$ mysql
174-
mysql> select * from users;
92+
### 6. For Shared Hosting
17593

176-
# change connection
177-
mysql> use sqlite;
178-
mysql> select * from users;
179-
```
180-
![MySQL Command](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/mysql-command.png)
94+
Upload `composer.phar` to your project root:
18195

182-
### Find Command
18396
```bash
184-
$ find ./ -name * -maxdepth 1
97+
curl -o composer.phar https://getcomposer.org/composer.phar
18598
```
186-
![Find Command](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/find-command.png)
18799

188-
### Find and Delete
189-
```bash
190-
$ find ./storage/logs -name * -maxdepth 1 -delete
191-
```
192-
![Find and Delete](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/find-and-delete.png)
100+
## Usage
193101

194-
### Vi
195-
```bash
196-
$ vi server.php
197-
```
198-
![Vi Command](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/vi-command.png)
102+
- Access terminal at: `/terminal`
103+
- Must be logged into Filament admin panel first
104+
- All Composer commands available: `composer install`, `composer update`, etc.
105+
- Smart Tinker: `tinker User::count()`, `tinker config(app.name)`
199106

200-
![Vi Editor](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/vi-editor.png)
107+
## Security
201108

202-
![Vi Save](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/vi-save.png)
109+
- Requires Filament authentication
110+
- Add role/permission checks in middleware as needed
111+
- Safe for shared hosting environments
203112

204-
### Tail
205-
```bash
206-
$ tail
207-
$ tail --line=1
208-
$ tail server.php
209-
$ tail server.php --line 5
210-
```
211-
![Tail Command](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/tail-command.png)
113+
## Commands Available
212114

115+
- **Artisan**: All Laravel artisan commands
116+
- **Tinker**: Interactive PHP with smart auto-corrections
117+
- **Composer**: Full Composer functionality
118+
- **System**: find, tail, cleanup, vi, mysql
213119

214-
### Cleanup
215-
```bash
216-
$ cleanup
217-
```
218-
![Cleanup Command](https://cdn.rawgit.com/recca0120/terminal/master/docs/screenshots/cleanup-command.png)
120+
## Troubleshooting
121+
122+
If Composer commands fail, ensure `composer.phar` is in your project root or Composer is installed on the server.
123+
124+
## Credits
125+
126+
Enhanced version of [recca0120/laravel-terminal](https://github.com/recca0120/laravel-terminal) with Laravel 11/12 compatibility and additional features.

0 commit comments

Comments
 (0)