PHP code example of phpointless / monolol

1. Go to this page and download the library: Download phpointless/monolol 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/ */

    

phpointless / monolol example snippets




use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolol\Handlers\LolHandler;
use Monolol\Lolifiers;

$logger = new Logger('myLog');
$streamHandler = new StreamHandler(__DIR__ . '/monolol.log');

$lolHandler = new LolHandler($streamHandler, new Lolifiers\Shuffle());

$logger->pushHandler($lolHandler);

$logger->info('My littlest pony');
$logger->error('This burger has no cheese');

$quoteProvider = new Lolifiers\QuoteProviders\Kaamelott\Kadoc();
$lolHandler = new LolHandler($streamHandler, new Lolifiers\Quote($quoteProvider));

$quoteProvider = new Lolifiers\QuoteProviders\Collection();
$quoteProvider->add(new Lolifiers\QuoteProviders\Kaamelott\Kadoc())
              ->add(new Lolifiers\QuoteProviders\Kaamelott\Karadoc())
              ->add(new Lolifiers\QuoteProviders\Kaamelott\Perceval());
$lolHandler = new LolHandler($streamHandler, new Lolifiers\Quote($quoteProvider));

$swearWordsProvider = new Lolifiers\SwearWordsProviders\DefaultProvider();
$lolHandler = new LolHandler($streamHandler, new Lolifiers\Tourette($swearWordsProvider));