這是一個將artisan移植到web介面的package,
並增加了一些自定義的command
在server不支援bash shell時,還能執行一些aritsan的命令
[packagist.org](https://packagist.org/packages/recca0120/terminal)
[github](https://github.com/recca0120/laravel-terminal)
# Laravel Web Artisan
[](https://packagist.org/packages/recca0120/terminal)
[](https://packagist.org/packages/recca0120/terminal)
[](https://packagist.org/packages/recca0120/terminal)
[](https://packagist.org/packages/recca0120/terminal)
[](https://packagist.org/packages/recca0120/terminal)
[](https://packagist.org/packages/recca0120/terminal)
## Installation
Add Presenter to your composer.json file:
```js
"require": {
"recca0120/terminal": "^1.3.3"
}
```
Now, run a composer update on the command line from the root of your project:
```
composer update
```
### Registering the Package
Include the service provider within `app/config/app.php`. The service povider is needed for the generator artisan command.
```php
'providers' => [
...
Recca0120\Terminal\ServiceProvider::class,
...
];
```
publish
```php
artisan vendor:publish --provider="Recca0120\Terminal\ServiceProvider"
```
### URL
http://localhost/path/to/terminal
### Whitelist
```php
return [
'whitelists' => ['127.0.0.1', 'your ip'],
];
```
## Available Commands
* artisan
* artisan tinker
* find
* mysql
### Find
not full support, but you can delete file use this function (please check file permission)
```bash
find ./vendor -name tests -type d -maxdepth 4 -delete
```
## Add Your Command
### Add Command Class
```php
// src/Console/Commands/Mysql.php
namespace Recca0120\Terminal\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
class Inspire extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'inspire';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
}
```
### Add Command
```php
// src/Console/Kernel.php
namespace Recca0120\Terminal\Console;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Recca0120\Terminal\Console\Application as Artisan;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\Inspire::class,
];
}
```
## ScreenShot
### Available Commands
```bash
$ help
```

### Artisan List
```bash
$ artisan
```

### Migrate
```bash
$ artisan migrate --seed
```

### Artisan Tinker
```bash
$ artisan tinker
```

### Find Command
```bash
$ find ./ -name * -maxdepth 1
```

### Find and Delete
```bash
$ find ./storage/logs -name * -maxdepth 1 -delete
```

### Vi
```bash
$ vi server.php
```



### Tail
```bash
$ tail
$ tail --line=1
$ tail server.php
$ tail server.php --line 5
```

### Cleanup
```bash
$ cleanup
```

沒有留言:
張貼留言