You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Laravel Zero provides the perfect starting point for your next Laravel Console Application.
16
+
-[Introduction](#introduction)
17
+
-[Installation](#installation)
18
+
-[Server Requirements](#server-requirements)
19
+
-[Documentation](#documentation)
20
+
-[Stay in touch](#stay-in-touch)
21
+
-[License](#license)
17
22
18
-
Is an MIT-licensed open source project UNDER DEVELOMENT.
23
+
<aname="introduction"></a>
24
+
## Introduction
19
25
26
+
Laravel Zero provides an elegant starting point for your next Laravel Console Application.
27
+
28
+
Is an MIT-licensed open source project UNDER DEVELOMENT.
29
+
30
+
<aname="server-requirements"></a>
20
31
## Server Requirements
21
32
22
33
<divclass="content-list"markdown="1">
23
34
- PHP >= 5.6.4
24
35
</div>
25
36
37
+
<aname="installation"></a>
26
38
## Installation
27
39
28
40
Laravel Zero utilizes [Composer](https://getcomposer.org) to manage its dependencies. So, before using Laravel Zero, make sure you have Composer installed on your machine.
@@ -31,10 +43,75 @@ Install Laravel Zero by issuing the Composer `create-project` command in your te
Laravel Zero provides a main command. That is the default one of your application, placed in app/Console/Commands/Main.php. You should fill in the `signature` and `description` properties of the class, which will be used when displaying your command on the `list` screen. The `handle` method will be called when your command is executed. You may place your command logic in this method.
50
+
51
+
Let's take a look at an example command.
52
+
53
+
<?php
54
+
55
+
namespace App\Console\Commands;
56
+
57
+
use App\DripEmailer;
58
+
use Illuminate\Console\Command;
59
+
60
+
class SendEmails extends Command
61
+
{
62
+
/**
63
+
* The name and signature of the console command.
64
+
*
65
+
* @var string
66
+
*/
67
+
protected $signature = 'email:send {email}';
68
+
69
+
/**
70
+
* The console command description.
71
+
*
72
+
* @var string
73
+
*/
74
+
protected $description = 'Send drip e-mails to a email';
75
+
76
+
/**
77
+
* The drip e-mail service.
78
+
*
79
+
* @var DripEmailer
80
+
*/
81
+
protected $drip;
82
+
83
+
/**
84
+
* Create a new command instance.
85
+
*
86
+
* @param DripEmailer|null $drip
87
+
* @return void
88
+
*/
89
+
public function __construct(DripEmailer $drip)
90
+
{
91
+
parent::__construct();
92
+
93
+
$this->drip = $drip ?: new DripEmailer;
94
+
}
95
+
96
+
/**
97
+
* Execute the console command.
98
+
*
99
+
* @return mixed
100
+
*/
101
+
public function handle()
102
+
{
103
+
$this->drip->send($this->argument('email'));
104
+
}
105
+
}
106
+
107
+
You may review the documentation of the Artisan Console component [on Laravel Official Website](https://laravel.com/docs/5.4/artisan).
108
+
109
+
<aname="stay-in-touch"></a>
34
110
## Stay In Touch
35
111
36
112
- For latest releases and announcements, follow on Twitter: [@enunomaduro](https://twitter.com/enunomaduro)
0 commit comments