I've been create simple package here is the structure of my directory
├── 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 ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire