title: PHP Cron Job Engine
body: <p>I was wondering how one would go about building a PHP Cron Job "engine".</p>
  
  <p>Essentially I am building a web app with "modules" which go and retrieve data at set intervals. I want these modules to be separate, but they all need to gather data at the same time (roughly) - some are once a day, others every 15 minutes.</p>
  
  <p>With several popular CMS's, you set up a cron job to hit a file every 5 minutes or so - what you can then do is "register" the cron job in each module rather than having to edit the cron tab every time you install a module.</p>
  
  <p>E.g.</p>
  
  <pre><code>*/5 * * * * php /path/to/cron.php
  </code></pre>
  
  <p>In the module you could then do something like</p>
  
  <pre><code>function task() {
      // do some work 
  }
  
  $cron-&gt;register(task())-&gt;daily();
  </code></pre>
  
  <p>Or similar - i'm not quite sure how to achieve it, nor am I sure what to search for!</p>
  
  <p><em>Edit: I'm not looking for something that will edit the crontab, I am also trying to avoid an SQL database. I know it won't happen magically and I'm happy to edit a master "file" to "install" a module.</em></p>
  
  <p><em>Edit 2: I suppose essentially what i'm looking for is like <a href="https://laravel.com/docs/5.3/scheduling" rel="nofollow">laravel</a> do, but without the database... possible?</em></p>
  
  <p>Hope it makes sense...</p>