Skip to content
This repository has been archived by the owner on Nov 28, 2017. It is now read-only.
/ reviewer Public archive

PHP library for track App Store reviews with Slack

License

Notifications You must be signed in to change notification settings

cmtt-ru/reviewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Reviewer

Simple library to track App Store reviews with Slack.

License Latest Stable Version

Installing via Composer

composer.phar require tjournal/reviewer

Next require Composer's autoloader:

require 'vendor/autoload.php';

Simple usage

You should use external database to store already sent reviews. We advice Redis with Predis library. Library should implement sismember, sadd, exists and set methods.

You need to create new Incoming webhook in Slack and change {APPID} with the real app id:

try {
    $storage = new Predis\Client();

    $reviewer = new TJ\Reviewer({APPID});
    $reviewer->setStorage($storage);
    $reviewer->setSlackSettings(['endpoint' => 'https://hooks.slack.com/services/ABCDE/QWERTY', 'channel' => '#reviews']);
    $reviewer->start();
} catch (Exception $e) {
    // handle errors
}

Then add your script to crontab:

sudo crontab -e
*/15 * * * *  php crontab.php

Monolog integration

If you want to track internal library errors you can use Monolog. Here is the easiest way:

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

$monolog = new Logger('Reviewer');
$monolog->pushHandler(new StreamHandler('/tmp/reviewer.log', Logger::DEBUG));

$reviewer->setLogger($monolog);

Countries

There is a way to change set of countries from whence Reviewer is getting fresh app's reviews.

try {
    $reviewer = new TJ\Reviewer({APPID});
    ...
    $reviewer->countries = ['ru' => 'Russia', 'us' => 'US', 'fi' => 'Finland', 'fr' => 'France'];

    $reviewer->start();
} catch (Exception $e) {
    // handle errors
}