PHP code example of aloskutov / php-fishtext

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

    

aloskutov / php-fishtext example snippets


use ALoskutov\FishText\FishText;
use ALoskutov\FishText\FishTextAdaptorLocal;

$fishtext = new FishText(new FishTextAdaptorLocal());

use ALoskutov\FishText\FishText;

$fishtext = new FishText();
$fishtext->setFormat('text');
echo $fishtext->title();

use ALoskutov\FishText\FishText;

$fishtext = new FishText();
$fishtext->setFormat('html');
echo $fishtext->paragraph(5);



declare(strict_types=1);

;

$fishtext = new FishText();

// Запрашиваем данные типа Заголовок, одно предложение (по-умолчанию)
var_dump($fishtext->title());

// Устанавливаем формат возвращаемых данных: HTML
$fishtext->setFormat('html');

// Запрашиваем данные типа Предложение, три предложения (по-умолчанию)
var_dump($fishtext->sentence());

// Запрашиваем данные типа Абзац, по умолчанию три абзаца (по-умолчанию)
var_dump($fishtext->paragraph());
shell
composer