Skip to content

Commit 3e73268

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: Minor fix [Scheduler] Document hashed cron expressions
2 parents 010ba38 + ee104c7 commit 3e73268

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

scheduler.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,31 @@ class, as shown in the following examples.
153153
Cron Expression Triggers
154154
~~~~~~~~~~~~~~~~~~~~~~~~
155155

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`_::
157164

158165
RecurringMessage::cron('* * * * *', new Message());
159166

160167
// optionally you can define the timezone used by the cron expression
161168
RecurringMessage::cron('* * * * *', new Message(), new \DateTimeZone('Africa/Malabo'));
162169

163-
Before using it, you have to install the following dependency:
170+
You can also use some special values that represent common cron expressions:
164171

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::
166179

167-
composer require dragonmantank/cron-expression
180+
RecurringMessage::cron('#daily', new Message());
168181

169182
.. tip::
170183

0 commit comments

Comments
 (0)