@@ -153,18 +153,31 @@ class, as shown in the following examples.
153
153
Cron Expression Triggers
154
154
~~~~~~~~~~~~~~~~~~~~~~~~
155
155
156
- It uses the same syntax as the `cron command-line utility `_::
156
+ Before using cron triggers, you have to install the following dependency:
157
+
158
+ .. code-block :: terminal
159
+
160
+ $ composer require dragonmantank/cron-expression
161
+
162
+ Then, define the trigger date/time using the same syntax as the
163
+ `cron command-line utility `_::
157
164
158
165
RecurringMessage::cron('* * * * *', new Message());
159
166
160
167
// optionally you can define the timezone used by the cron expression
161
168
RecurringMessage::cron('* * * * *', new Message(), new \DateTimeZone('Africa/Malabo'));
162
169
163
- Before using it, you have to install the following dependency :
170
+ You can also use some special values that represent common cron expressions :
164
171
165
- .. code-block :: terminal
172
+ * ``#yearly ``, ``#annually `` - Run once a year, midnight, Jan. 1 - ``0 0 1 1 * ``
173
+ * ``#monthly `` - Run once a month, midnight, first of month - ``0 0 1 * * ``
174
+ * ``#weekly `` - Run once a week, midnight on Sun - ``0 0 * * 0 ``
175
+ * ``#daily ``, ``#midnight `` - Run once a day, midnight - ``0 0 * * * ``
176
+ * ``#hourly `` - Run once an hour, first minute - ``0 * * * * ``
177
+
178
+ For example::
166
179
167
- composer require dragonmantank/cron-expression
180
+ RecurringMessage::cron('#daily', new Message());
168
181
169
182
.. tip ::
170
183
0 commit comments