This package is to add a web interface for Laravel 5 and earlier Artisan.

Related tags

Laravel nice-artisan
Overview

Nice Artisan

This package is to add a web interface for Laravel 5 and earlier Artisan.

Installation

Add Nice Artisan to your composer.json file :

  • For Laravel 5.1
    composer require bestmomo/nice-artisan:0.3.*
  • For Laravel 5.2
    composer require bestmomo/nice-artisan:0.4.*
  • For Laravel 5.3
    composer require bestmomo/nice-artisan:0.5.*
  • For Laravel 5.4
    composer require bestmomo/nice-artisan:1.0.*
  • For Laravel 5.5
    composer require bestmomo/nice-artisan:^1.1
  • For Laravel ^6.0
    composer require bestmomo/nice-artisan:^1.2
  • For Laravel ^7.0
    composer require bestmomo/nice-artisan:^1.3
  • For Laravel ^8.0
    composer require bestmomo/nice-artisan:^1.4

For Laravel < 5.5 the next required step is to add the service provider to config/app.php (for Laravel 5.5 there is the package discovery) :

    Bestmomo\NiceArtisan\NiceArtisanServiceProvider::class,

Last copy the package config to your local config with the publish command:

    php artisan vendor:publish --tag=niceartisan:config

You can change options and commands in config/commands.php. The menu is dynamically created with this config.

Now it must work with this url (you can also change it in the config file):

    .../niceartisan

Middleware

If you want to use this package on a production application you must protect the urls with a middleware for your security !

Add a route middleware to your application, for example :

<?php

namespace App\Http\Middleware;

use Closure;

class NiceArtisan
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $user = $request->user();

        if ($user && $user->isAdmin()) {
            return $next($request);
        }

        return redirect('/');
    }
}

And register it in Kernel with nice_artisan name :

'nice_artisan' => \App\Http\Middleware\NiceArtisan::class,

Screenshots

nice-artisan1 nice-artisan2 nice-artisan3

Comments
  • Class 'AppController' not found

    Class 'AppController' not found

    Hello Mr Maurice, nice job but still have some errors, and if i don't want to touch the vendor's code, i don't see how to resolve this issue, the NiceArtisanController extends the AppController . but where is this AppController, i don't see it in L5.2 How can i solve this problem ;-)

    opened by marwein 6
  • Nothing to publish for tag [niceartisan:config]. (??)

    Nothing to publish for tag [niceartisan:config]. (??)

    Bonjour, Pour commencer merci pour votre contribution et votre merveilleux cour sur le site du zero. Je débute avec Laravel et j'essaye d'installer votre package mais j'ai l'erreur suivante dans ma console :

    E:\wamp64\www\BDHELARAVEL52>php artisan vendor:publish --tag=niceartisan:config Nothing to publish for tag [niceartisan:config].

    Mon .json : { "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": ">=5.5.9", "laravel/framework": "5.2.", "laravelcollective/html": "5.2.", "bestmomo/nice-artisan": "0.4.*" },

    J'ai bien ajouté Bestmomo\NiceArtisan\NiceArtisanServiceProvider::class, dans mon fichier app.php.

    Et quand j'essaye d'atteindre nice-artisan : ErrorException in NiceArtisanController.php line 94: array_keys() expects parameter 1 to be array, null given

    Pourriez vous m'aider à résoudre le problème s'il vous plait ?

    Je vous remercie par avance

    opened by SparrowDevPro 3
  • Support Laravel 7

    Support Laravel 7

    Hi,

    do you plan to support Laravel 7 in the future?

    composer require bestmomo/nice-artisan
    Using version ^1.2 for bestmomo/nice-artisan
    ./composer.json has been updated
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - Installation request for bestmomo/nice-artisan ^1.2 -> satisfiable by bestmomo/nice-artisan[V1.2.0].
        - Conclusion: remove laravel/framework v7.0.8
        - Conclusion: don't install laravel/framework v7.0.8
    ...
    
    

    Thank you.

    opened by Nowi5 2
  • respecting config

    respecting config

    Tried to add console commands from another package. And it does not work.

    Tried to remove entire sections of the configuration file and it does not work.

    Why have a configuration file if you are not going to change what is available in the UX by using your configuration file.

    color me confused.

    -FT

    opened by ftrotter 2
  • argument default value

    argument default value

    In 0.3 and 0.4.0 in the index.blade.php view there is no check if the default value of the argument is array or string. This is fixed in version 0.4.1. As there are no other changes could you back port this in those versions?

    opened by ffogarasi 2
  • Fix issue #12

    Fix issue #12

    I don't understand what is the problem exactly, it's like some data are missing or if last merge has not worked properly. In my installation, after Composer Update, I have no change of commands config file, I have to modify NiceArtisanController in vendor and change array to make it working.

    opened by ghost 1
  • migrations / Checkbox

    migrations / Checkbox "Force operation.."

    except for the "migrate" command on all other migrate commands this checkbox does not change to a green hook when clicked and this makes it impossible to run e.g. "migrate:rollback" in production

    opened by aheissenberger 1
  • Add configuration for custom route

    Add configuration for custom route

    I needed to customize the route for /niceartisan, to I had to create another category of settings inside commands.php. I'm not sure if it's ok to you regarding compatibility issues.

    opened by tom-rb 0
  • Missing required parameter for [Route: niceartisan.exec] [URI: niceartisan/item/{class}] [Missing parameter: group]

    Missing required parameter for [Route: niceartisan.exec] [URI: niceartisan/item/{class}] [Missing parameter: group]

    1. Installed version 1.4
    2. Set up custom middleware

    When I run all of the non-custom commands, run just fine.

    When I click on the Customs link, I get the following error:

    Illuminate\Routing\Exceptions\UrlGenerationExceptionMissing required parameter for [Route: niceartisan.exec] [URI: niceartisan/item/{class}] [Missing parameter: group]. (View: /home/vagrant/code/mysite/vendor/bestmomo/nice-artisan/views/index.blade.php) http://mysite.test/niceartisan/customs`

    Laravel: 8.83.23 Nice-artisan 1.4

    opened by ksorbo 3
  • Custom Middleware problem

    Custom Middleware problem

    Hello, I did as stated in the documentation:

    Created a NiceArtisan Middlware:

    <?php
    
    namespace App\Http\Middleware;
    
    use Closure;
    use Illuminate\Http\Request;
    
    class NiceArtisan
    {
        /**
         * Handle an incoming request.
         *
         * @param  \Illuminate\Http\Request  $request
         * @param  \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse)  $next
         * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
         */
        public function handle(Request $request, Closure $next)
        {
            $user = $request->user();
            dd($request->user());
            if ($user && $user->developer == true) {
                return $next($request);
            }
    
            return abort(403);
        }
    }
    
    

    Added the middleware to the Kernel.php:

    <?php
    
    namespace App\Http;
    
    use Illuminate\Foundation\Http\Kernel as HttpKernel;
    
    class Kernel extends HttpKernel
    {
        /**
         * The application's global HTTP middleware stack.
         *
         * These middleware are run during every request to your application.
         *
         * @var array<int, class-string|string>
         */
        protected $middleware = [
            // \App\Http\Middleware\TrustHosts::class,
            \App\Http\Middleware\TrustProxies::class,
            \Illuminate\Http\Middleware\HandleCors::class,
            \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
            \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
            \App\Http\Middleware\TrimStrings::class,
            \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
        ];
    
        /**
         * The application's route middleware groups.
         *
         * @var array<string, array<int, class-string|string>>
         */
        protected $middlewareGroups = [
            'web' => [
                \App\Http\Middleware\EncryptCookies::class,
                \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
                \Illuminate\Session\Middleware\StartSession::class,
                \Illuminate\View\Middleware\ShareErrorsFromSession::class,
                \App\Http\Middleware\VerifyCsrfToken::class,
                \Illuminate\Routing\Middleware\SubstituteBindings::class,
            ],
    
            'api' => [
                // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
                'throttle:api',
                \Illuminate\Routing\Middleware\SubstituteBindings::class,
            ],
        ];
    
        /**
         * The application's route middleware.
         *
         * These middleware may be assigned to groups or used individually.
         *
         * @var array<string, class-string|string>
         */
        protected $routeMiddleware = [
            'auth' => \App\Http\Middleware\Authenticate::class,
            'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
            'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
            'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
            'can' => \Illuminate\Auth\Middleware\Authorize::class,
            'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
            'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
            'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
            'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
            'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
            'nice_artisan' => \App\Http\Middleware\NiceArtisan::class,
        ];
    }
    
    

    But it seems that $request->user() is always null, even if I'm logged in with a user. Assigning the middleware nice_artisan to the /home route (instead of the auth middleware) prints the $request->user() info correctly. Maybe it is registered too early in the package?

    opened by Doomkyn 3
  • Lumen Support

    Lumen Support

    Provide Lumen support

    Feel free to use this: https://github.com/kevupton/laravel-package-service-provider

    To support simple determination between lumen and laravel and then simple registering of alias. Just extend that service provider.

    opened by kevupton 0
  • Renaming the app

    Renaming the app

    When you rename the application, it will break the app if you use a naming convention that includes spaces or special characters. Recommend adding a validation to strip all non available char and remove spaces to prevent future users from breaking things.

    I broke the test environment I had setup and haven't tried naming the application with single string name yet to see if there's still an issue, doubtful.

    opened by Traqza 4
  • Invalid argument supplied for foreach() when using queue:retry

    Invalid argument supplied for foreach() when using queue:retry

    Artisan command queue:retry accept array as id of failed job(s), but the NiceArtisanController command function assign it as a single variable (line 152), instead of array.

    I don't know, if any other command has requirements like this, but an exception must handled in the assignation, when command is queue:retry.

    Or the config file should have parameters, where the command can be setted up for this purpose.

    kepernyofoto 2019-01-16 - 14 39 04

    opened by svolenszki 10
Owner
null
📝 Artisan Menu - Use Artisan via an elegant console GUI

?? Artisan Menu Use Artisan via an elegant console GUI Features Run built-in and custom Artisan commands from a console GUI Prompts to enter required

Jordan Hall 148 Nov 29, 2022
Create Laravel views (blade template) using 'php artisan' command-line interface

About LaraBit Have you ever wonder to create Laravel views (Blade Templates) using the same type of artisan commands that you usually use to create ne

Ragib MRB 5 Oct 15, 2021
A Laravel Artisan SQL Interactive Interface

sqli A Laravel 4 & 5 Artisan SQL Interactive Interface, plus a handful of Artisan commands to execute SQL queries. sqli It's like tinker for SQL, just

Antonio Carlos Ribeiro 61 Apr 18, 2022
Package for Laravel that gives artisan commands to setup and edit environment files.

Setup and work with .env files in Laravel from the command line NOTE: This doesn't work with Laravel 5 since .env files were changed. This is for Lara

Matt Brunt 6 Dec 17, 2022
A new way of Running Tinker. Simplify the Web Artisan's workflow.

Tinkerun A new way of Running Tinker. Simplify the Web Artisan's workflow. inspired by Tinkerwell Download links Github Releases ?? If you are using V

Tinkerun 327 Dec 29, 2022
A package that makes it easy to have the `artisan make:` commands open the newly created file in your editor of choice.

Open On Make A package that makes it easy to have the artisan make: commands open the newly created file in your editor of choice. Installation compos

Andrew Huggins 94 Nov 22, 2022
This package provides you with a simplistic `php artisan make:user` command

Laracademy Generators Laracademy make:user Command - provides you with a simplistic artisan command to generate users from the console. Author(s): Lar

Laracademy 18 Jan 19, 2019
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.

Webdevetc BlogEtc - Complete Laravel Blog Package Quickly add a blog with admin panel to your existing Laravel project. It has everything included (ro

WebDevEtc. 227 Dec 25, 2022
📦 Adds Laravel Packages Support to Lumen and Vendor Publish Artisan Command.

Laravel Package Support for Lumen: Makes Lumen compatible with Laravel Packages. You can use any Laravel Packages in Lumen by installing Larasupport Package.

Irfaq Syed 127 Dec 17, 2022
A nice GUI for Laravel Artisan, ready out of the box, configurable and handy for non-CLI experienced developers.

Artisan UI A nice GUI for Laravel Artisan, ready out of the box, configurable and handy for non-CLI experienced developers. Supported commands must be

Pablo Leone 1 Dec 3, 2021
This Laravel Nova tool lets you run artisan and bash commands directly from Nova 4 or higher.

Laravel Nova tool for running Artisan & Shell commands. This Nova tool lets you run artisan and bash commands directly from nova. This is an extended

Artem Stepanenko 17 Dec 15, 2022
Execute Laravel Artisan commands via REST APIs and HTTP requests safely.

Artisan Api There might be some times you wanted to execute an Artisan command, but you did not have access to shell or SSH. Here we brought REST API

Alireza 11 Sep 7, 2022
Generate services and contracts in Laravel with the artisan command

What does it do? This package adds a new php artisan make:service {name} {--N|noContract} command. It will create a service file and its contract (int

Ludovic Guénet 18 Dec 21, 2022
Laravel Soulbscription - This package provides a straightforward interface to handle subscriptions and features consumption.

About This package provides a straightforward interface to handle subscriptions and features consumption. Installation You can

Lucas Vinicius 269 Jan 1, 2023
Laravel 2-Step Verification is a package to add 2-Step user authentication to any Laravel project easily.

Laravel 2-Step verification is a package to add 2-Step user authentication to any Laravel project easily. It is configurable and customizable. It uses notifications to send the user an email with a 4-digit verification code. Laravel 2-Step Authentication Verification for Laravel. Can be used in out the box with Laravel's authentication scaffolding or integrated into other projects.

Jeremy Kenedy 204 Dec 23, 2022
Adds a way to write php and run it directly in Laravels' Artisan Tinker.

Adds a way to write php in PhpStorm/IDEA and run it directly as if through laravel artisan tinker - allowing you to quickly run a piece of code with a

Robbin 120 Jan 2, 2023
👀 Manage your views in Laravel projects through artisan

Artisan View This package adds a handful of view-related commands to Artisan in your Laravel project. Generate blade files that extend other views, sc

Sven Luijten 842 Dec 29, 2022
Dispatch Laravel jobs via Artisan

This package can register jobs as Artisan commands. All you need to do is let your job implement the empty ArtisanDispatchable interface.

Spatie 135 Nov 7, 2022
Generate services in Laravel with the artisan command

Laravel Service Generator Quickly generate services for your projects! Table of Contents Features Installation Usage Generate services Generate servic

Tim Wassenburg 15 Dec 2, 2022