1. Go to this page and download the library: Download justpush-io/php-jokeapi 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/ */
justpush-io / php-jokeapi example snippets
okeAPI\JokeClient;
use JokeAPI\JokeConstants;
// Create a new JokeClient
$client = new JokeClient();
// Get a random joke
$joke = $client->fetch();
// Print the joke
if ($joke['type'] === 'single') {
echo $joke['joke'];
} else {
echo "Setup: " . $joke['setup'] . "\n";
echo "Delivery: " . $joke['delivery'];
}