tjournal / newrphus
Newrphus — misprints reporting engine
Installs: 45 650
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 3
Forks: 1
pkg:composer/tjournal/newrphus
Requires
- php: >=5.4.0
- alek13/slack: ^1.10
- psr/log: ~1.0
Suggests
- monolog/monolog: Monolog sends your logs to files, sockets, inboxes, databases and various web services
README
Let users send misprints from your website to Slack.
Library contains PHP back-end library and Javascript front-end file. You should use both of them to make misprint reporter works.
When user selects text on a page and presses Ctrl+Enter, the Newrphus sends POST request to url. You can also include userId parameter to track users. Right after the keypress event, it calls callback function, where you can tell user that report was sent.
How to use
-
Create new Incoming webhook in Slack.
-
Install PHP library with Composer.
-
Create backend handler for JS Ajax call.
$newrphus = new TJ\Newrphus(); $reviewer->setSlackSettings([ 'endpoint' => 'https://hooks.slack.com/services/ABCDE/QWERTY', 'channel' => '#misprints' ]); $reviewer->report($_POST['misprintText'], $_POST['misprintUrl']);
If you want to customize Slack message, see
example.php. -
Include js to the page, where you want to track misprints.
<script src="js/newrphus.js"></script> <script> newrphus.init({ url: 'example.php', userId: 12345, callback: function() { alert('Misprint sent'); } }); </script>
-
Tell users to select text and press Ctrl+Enter to send report.
Installing via Composer
composer.phar require tjournal/newrphus
Then include Composer's autoloader:
require 'vendor/autoload.php';