mczolko/heroku-scheduler-bundle

Symfony HerokuSchedulerBundle

Installs: 1 891

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Type:symfony-bundle

v1.0.0 2016-03-17 13:51 UTC

This package is not auto-updated.

Last update: 2024-05-17 17:55:49 UTC


README

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:

$ 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.

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:

<?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

Open it and fill these values:

Heroku Scheduler

That's it. See Events.php file for available events which you can handle inside your app.

Note: In Symfony3 console is nolonger in app folder. Use php bin/console instead.

Usage

Create a event subscriber (or listener) for scheduler events. And do whatever you want. Freedom.

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
    }
}