DEV Community

Cover image for Stir some chaos into your schedules: Chaotic Schedule package
skywarth
skywarth

Posted on

Stir some chaos into your schedules: Chaotic Schedule package

Hello everyone, I would like to share a fresh Laravel Package I've developed with you. This package uses pRNG and cryptography methods to randomize scheduled command run intervals.

Chaotic Schedule

https://github.com/skywarth/chaotic-schedule

Laravel package for randomizing command schedule intervals via pRNGs.

Packagist: https://packagist.org/packages/skywarth/chaotic-schedule

Installation

  1. Consider the requirements

    • PHP >=7.4 is required
  2. Install the package via composer:

composer require skywarth/chaotic-schedule
Enter fullscreen mode Exit fullscreen mode
  1. (optional) Publish the config in order to customize it
 php artisan vendor:publish --provider "Skywarth\ChaoticSchedule\Providers\ChaoticScheduleServiceProvider" --tag="config"
Enter fullscreen mode Exit fullscreen mode
  1. Done. You may now use random time and date macros on schedules

Problem Definition

Ever wanted to run your scheduled commands on random times of the day, or on certain days of the week? Or you may need to send some notifications not on fixed date times, but rather on random intervals hence it feels more human. Then this is the package you're looking for.

This Laravel packages enables you to run commands on random intervals and periods while respecting the boundaries set exclusively by you.

Use Cases

  • I have a command to send notifications to my clients. But I would like it to be sent at a random time between 14:00 and 17:00
  • I would like to send some gifts to users if they are active between my special event period which is every week Friday and Saturday between 00:00 and 04:20
  • My boss asked me to generate and send statistical reports regarding database activities every month, but only on Monday, Wednesday and Friday. And this report has to be delivered in the morning between 08:00 and 09:30 and I want it to look like I've personally generated and sent it personally. So random time and date is crucial to stage this.
  • I would like to send reminders to customers and I want it to look and feel human. So random run times and dates every week would help me a lot. Otherwise, if I send every week on Tuesday 11:00 they would know this is automated and ignore these.
  • I'm trying to detect certain anomalies in my data, and therefore it would help me a lot to run a command completely randomly but with a minimum of at least 100 times a year.

Top comments (1)

Collapse
 
skywarth profile image
skywarth

bump