菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
3244
0

Web 版 Terminal (可執行 artisan)

原创
05/13 14:22
阅读数 2190

Donate

Laravel Web Artisan

StyleCI
Build Status
Total Downloads
Latest Stable Version
Latest Unstable Version
License
Monthly Downloads
Daily Downloads
Scrutinizer Code Quality
Code Coverage

Installation

Add Presenter to your composer.json file:

"require": {
    "recca0120/terminal": "^1.6.8"
}

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.

'providers' => [
    ...
    Recca0120\Terminal\TerminalServiceProvider::class,
    ...
];

publish

artisan vendor:publish --provider="Recca0120\Terminal\TerminalServiceProvider"

URL

http://localhost/path/to/terminal

config

return [
    'enabled'    => env('APP_DEBUG'),
    'whitelists' => ['127.0.0.1', 'your ip'],
    'route'     => [
        'prefix'     => 'terminal',
        'as'         => 'terminal.',
        'middleware' => ['web'], // if you use laravel 5.1 remove web
    ],
    'commands' => [
        \Recca0120\Terminal\Console\Commands\Artisan::class,
        \Recca0120\Terminal\Console\Commands\ArtisanTinker::class,
        \Recca0120\Terminal\Console\Commands\Cleanup::class,
        \Recca0120\Terminal\Console\Commands\Find::class,
        \Recca0120\Terminal\Console\Commands\Mysql::class,
        \Recca0120\Terminal\Console\Commands\Tail::class,
        \Recca0120\Terminal\Console\Commands\Vi::class,
        // add your command
    ],
];

Available Commands

  • artisan
  • artisan tinker
  • find
  • mysql

Find

not full support, but you can delete file use this function (please check file permission)

find ./vendor -name tests -type d -maxdepth 4 -delete

Add Your Command

Add Command Class

// 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);
    }
}

ScreenShot

Available Commands

$ help

Available Commands

Artisan List

$ artisan

Artisan List

Migrate

$ artisan migrate --seed

Migrate

Artisan Tinker

$ artisan tinker

Tinker

MySQL

$ mysql
mysql> select * from users;

MySQL Command

Find Command

$ find ./ -name * -maxdepth 1

Find Command

Find and Delete

$ find ./storage/logs -name * -maxdepth 1 -delete

Find and Delete

Vi

$ vi server.php

Vi Command

Vi Editor

Vi Save

Tail

$ tail
$ tail --line=1
$ tail server.php
$ tail server.php --line 5

Tail Command

Cleanup

$ cleanup

Cleanup Command

发表评论

0/200
3244 点赞
0 评论
收藏
为你推荐 换一批