donut-org/donut

v0.8.0 2018-07-02 17:30 UTC

This package is auto-updated.

Last update: 2024-12-21 20:19:22 UTC


README

Build Status

Become a Patron! Buy me a coffee

Installation

Download a latest package or use Composer:

composer require donut-org/donut

Donut requires PHP 5.6.0 or later.

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

// init
$adapter = new Donut\Adapters\DibiSqliteAdapter(__DIR__ . '/app/db.sq3');
$processor = new Donut\Processor($adapter, function () {
	sleep(5 * 60); // 5 minutes
});


// prepare tasks
$facebookQueue = $processor->createQueue('facebook-queue')
	->facebookPublishFacebookPost($accountId, $appId, $appSecret, $userAccessToken);

$processor->createQueue('blogposts-queue')
	->rssFeedFetchNewItems('https://example.com/feed/rss', '1h')
	->rssFeedConvertItemToFacebookPost('NEW BLOGPOST! %TITLE%', $facebookQueue);


// RUN!
$processor->run(100); // number of repeats

License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/