while run cron with lumen : There are no commands defined in the “insert” namespace.
up vote
0
down vote
favorite
I have written code for cron command as below in lumen (micro framwork of laravel)
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use AppModelsEmailDump;
use DB;
/**
* dumpEmails Class
*
* This cron is to dump emails with cron use
*
* @author Hetal Gohel <hetal.gohel@brainvire.com>
*
*/
class dumpEmails extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'insert:emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This cron is to dump emails with cron use';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "1";die;
}
}
in kernel file defined as below,
<?php
namespace AppConsole;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
LaravelistaLumenVendorPublishVendorPublishCommand::class,
'AppConsoleCommandsdumpEmails',
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
// protected function schedule(Schedule $schedule)
// {
// return $schedule;
// }
}
I have fired command from console as below,
php artisan insert:emails
while run this command getting error as below,
[SymfonyComponentConsoleExceptionCommandNotFoundException] ←[39;49m
←[37;41m There are no commands defined in the "insert" namespace.
please help me to resolve this issue.thank you.
php laravel lumen
add a comment |
up vote
0
down vote
favorite
I have written code for cron command as below in lumen (micro framwork of laravel)
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use AppModelsEmailDump;
use DB;
/**
* dumpEmails Class
*
* This cron is to dump emails with cron use
*
* @author Hetal Gohel <hetal.gohel@brainvire.com>
*
*/
class dumpEmails extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'insert:emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This cron is to dump emails with cron use';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "1";die;
}
}
in kernel file defined as below,
<?php
namespace AppConsole;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
LaravelistaLumenVendorPublishVendorPublishCommand::class,
'AppConsoleCommandsdumpEmails',
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
// protected function schedule(Schedule $schedule)
// {
// return $schedule;
// }
}
I have fired command from console as below,
php artisan insert:emails
while run this command getting error as below,
[SymfonyComponentConsoleExceptionCommandNotFoundException] ←[39;49m
←[37;41m There are no commands defined in the "insert" namespace.
please help me to resolve this issue.thank you.
php laravel lumen
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have written code for cron command as below in lumen (micro framwork of laravel)
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use AppModelsEmailDump;
use DB;
/**
* dumpEmails Class
*
* This cron is to dump emails with cron use
*
* @author Hetal Gohel <hetal.gohel@brainvire.com>
*
*/
class dumpEmails extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'insert:emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This cron is to dump emails with cron use';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "1";die;
}
}
in kernel file defined as below,
<?php
namespace AppConsole;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
LaravelistaLumenVendorPublishVendorPublishCommand::class,
'AppConsoleCommandsdumpEmails',
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
// protected function schedule(Schedule $schedule)
// {
// return $schedule;
// }
}
I have fired command from console as below,
php artisan insert:emails
while run this command getting error as below,
[SymfonyComponentConsoleExceptionCommandNotFoundException] ←[39;49m
←[37;41m There are no commands defined in the "insert" namespace.
please help me to resolve this issue.thank you.
php laravel lumen
I have written code for cron command as below in lumen (micro framwork of laravel)
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use AppModelsEmailDump;
use DB;
/**
* dumpEmails Class
*
* This cron is to dump emails with cron use
*
* @author Hetal Gohel <hetal.gohel@brainvire.com>
*
*/
class dumpEmails extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'insert:emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This cron is to dump emails with cron use';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "1";die;
}
}
in kernel file defined as below,
<?php
namespace AppConsole;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
LaravelistaLumenVendorPublishVendorPublishCommand::class,
'AppConsoleCommandsdumpEmails',
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
// protected function schedule(Schedule $schedule)
// {
// return $schedule;
// }
}
I have fired command from console as below,
php artisan insert:emails
while run this command getting error as below,
[SymfonyComponentConsoleExceptionCommandNotFoundException] ←[39;49m
←[37;41m There are no commands defined in the "insert" namespace.
please help me to resolve this issue.thank you.
php laravel lumen
php laravel lumen
asked 20 hours ago
hetal gohel
989
989
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
Please remove __construct
and keep just the handle
method.
Also, when you are listing under $commands at Kernel
you need to specify the class.
So your
`AppConsoleCommandsdumpEmails`
becomes
DumpEmails::class
A few extra tips:
- Class names are capitalised; (dumpEmails -> DumpEmails)
- Add the
{
to a new line;
This
class dumpEmails extends Command {
should be
class DumpEmails extends Command
{
I also recommend checking out about PSR-x standards. I left one of the blogs I think might help you kick start with them, but go further! :)
Last, but not least, do not forget Command
Parent already lets you use its command line potential. So if you wish to output and debug, you can do so by using:
$this->info('Your message to inform');
$this->error('Your error message');
I have done above given changes, still same issue, my lumen version is 5.2.*
– hetal gohel
20 hours ago
Hmmm, may I ask that you update with the changes please? So I have a map on how things are setting up there? :) As far as I am currently aware I would have believe that removing the__construct
and setting the class properly atKernel
class would suffice thinking
– Diogo Santo
19 hours ago
let me update my updates in anser
– hetal gohel
19 hours ago
I also made a small change that might be worth to try. If you could, remove the default path form your kernel class, pointing to your command class. If you notice, I just removedAppConsoleCommandsdumpEmails
and left asCommandsdumpEmails
. That becauseKernel
might be already mapping it to the default folder
– Diogo Santo
19 hours ago
this one is also not working
– hetal gohel
19 hours ago
|
show 6 more comments
up vote
0
down vote
I have update my code as per you suggestion as below,
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use AppModelsEmailDump;
use DB;
/**
* dumpEmails Class
*
* This cron is to dump emails with cron use
*
* @author Hetal Gohel <hetal.gohel@brainvire.com>
*
*/
class DumpEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'insert:emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This cron is to dump emails with cron use';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "1";die;
}
}
in kernel file I have updated as below,
<?php
namespace AppConsole;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
LaravelistaLumenVendorPublishVendorPublishCommand::class,
AppConsoleCommandsDumpEmails::class
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
// protected function schedule(Schedule $schedule)
// {
// return $schedule;
// }
}
but it is still giving me same error , my php version is 5.6.38 and my lumen version is 5.2.*
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Please remove __construct
and keep just the handle
method.
Also, when you are listing under $commands at Kernel
you need to specify the class.
So your
`AppConsoleCommandsdumpEmails`
becomes
DumpEmails::class
A few extra tips:
- Class names are capitalised; (dumpEmails -> DumpEmails)
- Add the
{
to a new line;
This
class dumpEmails extends Command {
should be
class DumpEmails extends Command
{
I also recommend checking out about PSR-x standards. I left one of the blogs I think might help you kick start with them, but go further! :)
Last, but not least, do not forget Command
Parent already lets you use its command line potential. So if you wish to output and debug, you can do so by using:
$this->info('Your message to inform');
$this->error('Your error message');
I have done above given changes, still same issue, my lumen version is 5.2.*
– hetal gohel
20 hours ago
Hmmm, may I ask that you update with the changes please? So I have a map on how things are setting up there? :) As far as I am currently aware I would have believe that removing the__construct
and setting the class properly atKernel
class would suffice thinking
– Diogo Santo
19 hours ago
let me update my updates in anser
– hetal gohel
19 hours ago
I also made a small change that might be worth to try. If you could, remove the default path form your kernel class, pointing to your command class. If you notice, I just removedAppConsoleCommandsdumpEmails
and left asCommandsdumpEmails
. That becauseKernel
might be already mapping it to the default folder
– Diogo Santo
19 hours ago
this one is also not working
– hetal gohel
19 hours ago
|
show 6 more comments
up vote
1
down vote
Please remove __construct
and keep just the handle
method.
Also, when you are listing under $commands at Kernel
you need to specify the class.
So your
`AppConsoleCommandsdumpEmails`
becomes
DumpEmails::class
A few extra tips:
- Class names are capitalised; (dumpEmails -> DumpEmails)
- Add the
{
to a new line;
This
class dumpEmails extends Command {
should be
class DumpEmails extends Command
{
I also recommend checking out about PSR-x standards. I left one of the blogs I think might help you kick start with them, but go further! :)
Last, but not least, do not forget Command
Parent already lets you use its command line potential. So if you wish to output and debug, you can do so by using:
$this->info('Your message to inform');
$this->error('Your error message');
I have done above given changes, still same issue, my lumen version is 5.2.*
– hetal gohel
20 hours ago
Hmmm, may I ask that you update with the changes please? So I have a map on how things are setting up there? :) As far as I am currently aware I would have believe that removing the__construct
and setting the class properly atKernel
class would suffice thinking
– Diogo Santo
19 hours ago
let me update my updates in anser
– hetal gohel
19 hours ago
I also made a small change that might be worth to try. If you could, remove the default path form your kernel class, pointing to your command class. If you notice, I just removedAppConsoleCommandsdumpEmails
and left asCommandsdumpEmails
. That becauseKernel
might be already mapping it to the default folder
– Diogo Santo
19 hours ago
this one is also not working
– hetal gohel
19 hours ago
|
show 6 more comments
up vote
1
down vote
up vote
1
down vote
Please remove __construct
and keep just the handle
method.
Also, when you are listing under $commands at Kernel
you need to specify the class.
So your
`AppConsoleCommandsdumpEmails`
becomes
DumpEmails::class
A few extra tips:
- Class names are capitalised; (dumpEmails -> DumpEmails)
- Add the
{
to a new line;
This
class dumpEmails extends Command {
should be
class DumpEmails extends Command
{
I also recommend checking out about PSR-x standards. I left one of the blogs I think might help you kick start with them, but go further! :)
Last, but not least, do not forget Command
Parent already lets you use its command line potential. So if you wish to output and debug, you can do so by using:
$this->info('Your message to inform');
$this->error('Your error message');
Please remove __construct
and keep just the handle
method.
Also, when you are listing under $commands at Kernel
you need to specify the class.
So your
`AppConsoleCommandsdumpEmails`
becomes
DumpEmails::class
A few extra tips:
- Class names are capitalised; (dumpEmails -> DumpEmails)
- Add the
{
to a new line;
This
class dumpEmails extends Command {
should be
class DumpEmails extends Command
{
I also recommend checking out about PSR-x standards. I left one of the blogs I think might help you kick start with them, but go further! :)
Last, but not least, do not forget Command
Parent already lets you use its command line potential. So if you wish to output and debug, you can do so by using:
$this->info('Your message to inform');
$this->error('Your error message');
edited 19 hours ago
answered 20 hours ago
Diogo Santo
1477
1477
I have done above given changes, still same issue, my lumen version is 5.2.*
– hetal gohel
20 hours ago
Hmmm, may I ask that you update with the changes please? So I have a map on how things are setting up there? :) As far as I am currently aware I would have believe that removing the__construct
and setting the class properly atKernel
class would suffice thinking
– Diogo Santo
19 hours ago
let me update my updates in anser
– hetal gohel
19 hours ago
I also made a small change that might be worth to try. If you could, remove the default path form your kernel class, pointing to your command class. If you notice, I just removedAppConsoleCommandsdumpEmails
and left asCommandsdumpEmails
. That becauseKernel
might be already mapping it to the default folder
– Diogo Santo
19 hours ago
this one is also not working
– hetal gohel
19 hours ago
|
show 6 more comments
I have done above given changes, still same issue, my lumen version is 5.2.*
– hetal gohel
20 hours ago
Hmmm, may I ask that you update with the changes please? So I have a map on how things are setting up there? :) As far as I am currently aware I would have believe that removing the__construct
and setting the class properly atKernel
class would suffice thinking
– Diogo Santo
19 hours ago
let me update my updates in anser
– hetal gohel
19 hours ago
I also made a small change that might be worth to try. If you could, remove the default path form your kernel class, pointing to your command class. If you notice, I just removedAppConsoleCommandsdumpEmails
and left asCommandsdumpEmails
. That becauseKernel
might be already mapping it to the default folder
– Diogo Santo
19 hours ago
this one is also not working
– hetal gohel
19 hours ago
I have done above given changes, still same issue, my lumen version is 5.2.*
– hetal gohel
20 hours ago
I have done above given changes, still same issue, my lumen version is 5.2.*
– hetal gohel
20 hours ago
Hmmm, may I ask that you update with the changes please? So I have a map on how things are setting up there? :) As far as I am currently aware I would have believe that removing the
__construct
and setting the class properly at Kernel
class would suffice thinking– Diogo Santo
19 hours ago
Hmmm, may I ask that you update with the changes please? So I have a map on how things are setting up there? :) As far as I am currently aware I would have believe that removing the
__construct
and setting the class properly at Kernel
class would suffice thinking– Diogo Santo
19 hours ago
let me update my updates in anser
– hetal gohel
19 hours ago
let me update my updates in anser
– hetal gohel
19 hours ago
I also made a small change that might be worth to try. If you could, remove the default path form your kernel class, pointing to your command class. If you notice, I just removed
AppConsoleCommandsdumpEmails
and left as CommandsdumpEmails
. That because Kernel
might be already mapping it to the default folder– Diogo Santo
19 hours ago
I also made a small change that might be worth to try. If you could, remove the default path form your kernel class, pointing to your command class. If you notice, I just removed
AppConsoleCommandsdumpEmails
and left as CommandsdumpEmails
. That because Kernel
might be already mapping it to the default folder– Diogo Santo
19 hours ago
this one is also not working
– hetal gohel
19 hours ago
this one is also not working
– hetal gohel
19 hours ago
|
show 6 more comments
up vote
0
down vote
I have update my code as per you suggestion as below,
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use AppModelsEmailDump;
use DB;
/**
* dumpEmails Class
*
* This cron is to dump emails with cron use
*
* @author Hetal Gohel <hetal.gohel@brainvire.com>
*
*/
class DumpEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'insert:emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This cron is to dump emails with cron use';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "1";die;
}
}
in kernel file I have updated as below,
<?php
namespace AppConsole;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
LaravelistaLumenVendorPublishVendorPublishCommand::class,
AppConsoleCommandsDumpEmails::class
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
// protected function schedule(Schedule $schedule)
// {
// return $schedule;
// }
}
but it is still giving me same error , my php version is 5.6.38 and my lumen version is 5.2.*
add a comment |
up vote
0
down vote
I have update my code as per you suggestion as below,
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use AppModelsEmailDump;
use DB;
/**
* dumpEmails Class
*
* This cron is to dump emails with cron use
*
* @author Hetal Gohel <hetal.gohel@brainvire.com>
*
*/
class DumpEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'insert:emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This cron is to dump emails with cron use';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "1";die;
}
}
in kernel file I have updated as below,
<?php
namespace AppConsole;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
LaravelistaLumenVendorPublishVendorPublishCommand::class,
AppConsoleCommandsDumpEmails::class
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
// protected function schedule(Schedule $schedule)
// {
// return $schedule;
// }
}
but it is still giving me same error , my php version is 5.6.38 and my lumen version is 5.2.*
add a comment |
up vote
0
down vote
up vote
0
down vote
I have update my code as per you suggestion as below,
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use AppModelsEmailDump;
use DB;
/**
* dumpEmails Class
*
* This cron is to dump emails with cron use
*
* @author Hetal Gohel <hetal.gohel@brainvire.com>
*
*/
class DumpEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'insert:emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This cron is to dump emails with cron use';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "1";die;
}
}
in kernel file I have updated as below,
<?php
namespace AppConsole;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
LaravelistaLumenVendorPublishVendorPublishCommand::class,
AppConsoleCommandsDumpEmails::class
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
// protected function schedule(Schedule $schedule)
// {
// return $schedule;
// }
}
but it is still giving me same error , my php version is 5.6.38 and my lumen version is 5.2.*
I have update my code as per you suggestion as below,
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use AppModelsEmailDump;
use DB;
/**
* dumpEmails Class
*
* This cron is to dump emails with cron use
*
* @author Hetal Gohel <hetal.gohel@brainvire.com>
*
*/
class DumpEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'insert:emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This cron is to dump emails with cron use';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "1";die;
}
}
in kernel file I have updated as below,
<?php
namespace AppConsole;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
LaravelistaLumenVendorPublishVendorPublishCommand::class,
AppConsoleCommandsDumpEmails::class
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
// protected function schedule(Schedule $schedule)
// {
// return $schedule;
// }
}
but it is still giving me same error , my php version is 5.6.38 and my lumen version is 5.2.*
answered 19 hours ago
hetal gohel
989
989
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372057%2fwhile-run-cron-with-lumen-there-are-no-commands-defined-in-the-insert-namesp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown