Coder Social home page Coder Social logo

laravel-terminal's Introduction

Donate

Laravel Terminal

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

Installation

composer require recca0120/terminal --dev

OR

Add Presenter to your composer.json file:

"require-dev": {
    "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.',
        // if you use laravel 5.1, remember to remove web middleware
        'middleware' => ['web'],
        // if you need auth, you need use web and auth middleware
        // 'middleware' => ['web', 'auth']
    ],
    '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
  • tail
  • vi

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;
use Recca0120\Terminal\Contracts\TerminalCommand;

class Inspire extends Command implements TerminalCommand
{
    /**
     * 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;

# change connection
mysql> use sqlite;
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

laravel-terminal's People

Contributors

erjanmx avatar owenvoke avatar recca0120 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-terminal's Issues

Internal Server Error

screenshot 2015-11-13 15 25 19

Error Message:

Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

Any idea?

It's not working in L 5.4

I have installed and followed all instructions but it not working
Publish also had been successful
Copied File [\vendor\recca0120\terminal\config\terminal.php] To [\config\terminal.php] Copied Directory [\vendor\recca0120\terminal\resources\views] To [\resources\views\vendor\terminal] Copied Directory [\vendor\recca0120\terminal\public] To [\public\vendor\terminal] Publishing complete.

But no result http://localhost/mysite/public/terminal .. Showing 404 Page

Update for Laravel 5.5

Current error is:

Declaration of Recca0120\Terminal\Application::call($command, array $parameters = Array) must be compatible with Illuminate\Console\Application::call($command, array $parameters = Array, $outputBuffer = NULL)

Laravel method don't work

When i try to execute method like [ask, choice] nothing happen

if($this->argument('code') != null) {
    $name = $this->ask('What is your name?');
    $this->comment($name);
} else {
    $this->comment('all');
}

Result :

image

in CMD :

image

Laravel Framework 5.5.48

Js error

L5.6 Maximum function nesting level of '256' reached, aborting!

Hi, I've installed this package in my project but when I go to /terminal get this error:

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Maximum function nesting level of '256' reached, aborting!

image

I've tried with
php artisan config:clear
php artisan cache:clear
php artisan view:clear
and still same problem.

I'm using Laravel 5.6

Wrong Output

Thanks for nice package !

I am using this package https://github.com/beyondcode/laravel-self-diagnosis and when I run its command in terminal, it yeilds wrong output:

image

Expected output is something like:

image

The package I am using uses translations via Laravel built-in trans() function like:

$this->output->writeln(trans('self-diagnosis::commands.self_diagnosis.environment_specific_checks']));

So it seems your package does not translate back to terminal messages coming via translations.

Thanks

multi environments support

it is very useful to let configure the packages in a way that the user will be able to choose commands based on environment type.

if you ok I will create a PR for that?

Document the config file

It is not obvious what it means to be in the "confirmToProceed" section or what "interpreters" means. Or what "route" does. I think I can guess what the whitelist section does... but others might have trouble. and it is not clear how enabling or disabling debuging would help.

Have read the readme, and it did not cover how to use the config file.. and the version of the config file that is listed in the readme does not match the contents of the auto-generated file.

It would help if these things were clearly explained.

Unescaped Characters Displaying

Occasionally, I will see characters pop up which appear like they should have been escaped, but they weren't. One such example:

image

A very excellent tool, helpful for debugging in multiple environments.

Does not seem to work for L9

Installed on L9 with v1.10.0 and it doesn't seem to work. When going to the /terminal page, the default commands that are published in the terminal.commands config do not appear. Even putting in my own console commands do not seem to work.

image

Getting JSON Error

When we run our custom laravel console commands, we get following error:

200: SyntaxError: Unexpected token E in JSON at position 0

Can you please tell what could be wrong ?

Thanks

Support Laravel 6

Actual Behaviour
I can't upgrade to Laravel 6.0 because recca0120/laravel-terminal requires illuminate/filesystem ^5.1

Expected Behaviour
Upgrading to 6.0

Steps to Reproduce
Update laravel/framework to 6.0
composer update

Failure on arisan migrate:refresh when there are web middleware using the db

I get internal server error when running artisan migrations because the request is sent as a web request, thus the pass through some middleware which are not supposed to be executed in console mode.

I suggest you find a way to switch laravel to console mode when processing requests from the terminal.

How to run a raw SQL?

When I use the terminal ,it will throw a SQL syntax error. The SQL is SELECT * FROM users WHERE name LIKE "%xxxx%".
I checked the terminal.js, and I found it has trimed the quot before sending to the server.
Thanks for your help.

Tinker don't work

Hello! Your package is perfect, but there is one problem:
Any tinker team responds as follows:
LARAVEL@WIN-8GUN6NS8Q8B:~ $ App\User::all()->toArray() Error: Request failed with status code 500

In logs i see:
Class 'AppUser' not found

How fix this?

Support other /vendor artisan commands

We are writing our own artisan console commands, in our own name spaces.

We successfully add them to the artisan command when we run it through the unix terminal, but they do not show up in this web terminal.

The instructions indicate that we must namespace additional commands under:

namespace Recca0120\Terminal\Console\Commands;

But we have good reasons for having our own namespaces for our console applications.

Perhaps we could just have a flag in our console command class called 'enable_run_through_web' or something similar which would be an indication that a command should be accessible through your app.

Alternatively rather than an inherited class, your system could rely on classes to implement an interface of some kind? http://php.net/manual/en/language.oop5.interfaces.php

Thank you for your work a very clever approach to a common problem with Laravel.

-FT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.