PHP code example of eislambey / amp-mercure-publisher
1. Go to this page and download the library: Download eislambey/amp-mercure-publisher library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eislambey / amp-mercure-publisher example snippets
use Amp\Loop;
use Islambey\Amp\Mercure\Publisher;
use Symfony\Component\Mercure\Jwt\StaticJwtProvider;
use Symfony\Component\Mercure\Update;
2giOlsiKiJdfX0.obDjwCgqtPuIvwBlTxUEmibbBf0zypKCNzNKP7Op2UM');
Loop::run(function () {
$jwtProvider = new StaticJwtProvider(JWT);
$publisher = new Publisher(HUB_URL, $jwtProvider);
$update = new Update('https://example.com/books/1.jsonld', 'Hi from Amp!');
var_dump(yield $publisher->publish($update));
});