vendredi 30 août 2019

Create Laravel Package but Command not Listed On Artisan

I've been create simple package here is the structure of my directory and using laravel 5.4

├── composer.json
└── src
    ├── ArtisanTestmeServiceProvider.php
    └── Commands
        └── TestmeCommand.php

my problem is, my custom command not listed on artisan (php artisan)

here is the source code of TestMeCommand.php

<?php

namespace TestMe\Commands;

use Illuminate\Console\Command;

class TestmeCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'testme:run';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'lorem ipsum';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        //
        $this->info("Version : test test");
    }
}

and here is the ServiceProvider ArtisanTestmeServiceProvider

<?php

namespace TestMe\Commands;

use Illuminate\Support\ServiceProvider;

class ArtisanTestmeServiceProvider extends ServiceProvider
{
    protected $commands = [
        'robyfirnandoyusuf\TestMe\Commands\TestmeCommand',
    ];


    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->commands($this->commands);
    }
}

and below is composer.json in my package

{
    "name": "robyfirnandoyusuf/lara-testme",
    "description": "test",
    "license": "MIT",
    "authors": [
        {
            "name": "Roby Firnando Yusuf",
            "email": "idonthave@gmail.com"
        }
    ],
    "minimum-stability": "dev",
    "require": {},
    "autoload" : {
        "psr-4":{
            "TestMe\\": "src/"
        }
    },
    "extra":{
        "laravel":{
            "providers":[
                "TestMe\\Commands\\ArtisanTestmeServiceProvider"
            ]
        }
    }
}

and at composer.json on laravel project , I've been added :

 "repositories":[
        {
            "type": "path",
            "url": "../Packagistku/TestPackage/"
        }
    ],

Am I miss something so that my custom command not listed on artisan command ?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/34ceX8E
via IFTTT

Aucun commentaire:

Enregistrer un commentaire