PHP code example of sissokho / laravel-dev-joke
1. Go to this page and download the library: Download sissokho/laravel-dev-joke 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/ */
sissokho / laravel-dev-joke example snippets
use Sissokho\LaravelDevJoke\DevJoke;
public function joke(DevJoke $devJoke)
{
$joke = $devJoke->random();
$joke->question; // retrieve the question
$joke->punchline; // retrieve the punchline
$joke->toArray(); // ['question' => 'lorem', 'punchline' => 'ipsum']
}
use Sissokho\LaravelDevJoke\Facades\DevJoke;
$joke = DevJoke::random();
bash
php artisan devjoke