PHP code example of aheenam / estimated-reading-time

1. Go to this page and download the library: Download aheenam/estimated-reading-time 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/ */

    

aheenam / estimated-reading-time example snippets




// text with 400 words
$text = \Faker\Factory::create()->words(400, true);

// returns 2
(new EstimatedReadingTime)
    ->setText($text)
    ->calculateTime();



// text with 400 words
$text = \Faker\Factory::create()->words(400, true);

// returns 1
(new EstimatedReadingTime)
    ->setWordsPerMinute(400)
    ->setText($text)
    ->calculateTime();



$text = \Faker\Factory::create()->words(650, true);

// returns 3.25
(new EstimatedReadingTime)
    ->exactTime(true)
    ->setText($text)
    ->calculateTime();

// returns 3
(new EstimatedReadingTime)
    ->setText($text)
    ->calculateTime();