Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the
following command to download the latest stable version of this bundle:, (*1)
$ composer require mczolko/heroku-scheduler-bundle
This command requires you to have Composer installed globally, as explained
in the installation chapter
of the Composer documentation., (*2)
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:, (*3)
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new mCzolko\HerokuSchedulerBundle\mCzolkoHerokuSchedulerBundle(),
);
// ...
}
// ...
}
Setup the Scheduler on Heroku
Install the addon: https://elements.heroku.com/addons/scheduler, (*4)
Open it and fill these values:, (*5)
, (*6)
That's it. See Events.php file for available events which you can handle inside your app., (*7)
Note: In Symfony3 console is nolonger in app folder. Use php bin/console
instead., (*8)
Usage
Create a event subscriber (or listener) for scheduler events. And do whatever you want. Freedom., (*9)
use mCzolko\HerokuSchedulerBundle\Events;
class HerokuSchedulerSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return [
Events::TEN_MINUTES => 'tenMinutes',
Events::HOURLY => 'hourly',
Events::DAILY => 'daily'
];
}
public function tenMinutes()
{
// Check notifications on your Apple watch
}
public function hourly()
{
// Send message at least one hot chick on Badoo
}
public function daily()
{
// https://www.youtube.com/watch?v=lxptFSJJ14Y
}
}