@@ -272,14 +272,37 @@ defined by PHP datetime functions::
272
272
RecurringMessage::every('3 weeks', new Message());
273
273
RecurringMessage::every('first Monday of next month', new Message());
274
274
275
- $from = new \DateTimeImmutable('13:47', new \DateTimeZone('Europe/Paris'));
276
- $until = '2023-06-12';
277
- RecurringMessage::every('first Monday of next month', new Message(), $from, $until);
278
-
279
275
.. tip ::
280
276
281
277
You can also define periodic tasks using :ref: `the AsPeriodicTask attribute <scheduler-attributes-periodic-task >`.
282
278
279
+ Be aware that the message isn't passed to the scheduler when you start the
280
+ messenger. The message will only be executed after the first frequency period
281
+ has passed.
282
+
283
+ It's also possible to pass a from and until time for your schedule. For
284
+ example, if you want to execute a command every day at 13:00::
285
+
286
+ $from = new \DateTimeImmutable('13:00', new \DateTimeZone('Europe/Paris'));
287
+ RecurringMessage::every('1 day', new Message(), from: $from);
288
+
289
+ Or if you want to execute a message every day until a specific date::
290
+
291
+ $until = '2023-06-12';
292
+ RecurringMessage::every('1 day', new Message(), until: $until);
293
+
294
+ And you can even combine the from and until parameters for more granular
295
+ control::
296
+
297
+ $from = new \DateTimeImmutable('13:47', new \DateTimeZone('Europe/Paris'));
298
+ $until = '2023-06-12';
299
+ RecurringMessage::every('first Monday of next month', new Message(), from: $from, until: $until);
300
+
301
+ If you don't pass a from parameter to your schedule, the first frequency period
302
+ is counted from the moment the scheduler is started. So if you start your
303
+ scheduler at 8:33 and the message is scheduled to perform every hour, it
304
+ will be executed at 9:33, 10:33, 11:33 and so on.
305
+
283
306
Custom Triggers
284
307
~~~~~~~~~~~~~~~
285
308
0 commit comments