dev-master
9999999-devCalculate the reading time for any given webpage
MIT
The Requires
- php ^7.1
The Development Requires
0.1.0
0.1.0.0Calculate the reading time for any given webpage
MIT
The Requires
- php ^7.1
The Development Requires
Wallogit.com
2017 © Pedro Peláez
Calculate the reading time for any given webpage
Calculate the estimated reading time of any given webpage., (*1)
You can install the package via composer:, (*2)
composer require aheenam/estimated-reading-time
The following command returns the rounded number of estimated minutes to read the given text., (*3)
<?php
// text with 400 words
$text = \Faker\Factory::create()->words(400, true);
// returns 2
(new EstimatedReadingTime)
->setText($text)
->calculateTime();
In most of the cases in the web, you do not have a plain text but a HTML fragment, but that does not matter. Internally the tags are stripped away when you use setText(), (*4)
By default the assumption is made that one is able to read 200 words per minute, but you can easily change this config by setting the property $wordsPerMinute, (*5)
<?php
// text with 400 words
$text = \Faker\Factory::create()->words(400, true);
// returns 1
(new EstimatedReadingTime)
->setWordsPerMinute(400)
->setText($text)
->calculateTime();
Another default configuration is that this package returns a rounded number of minutes. You can though get a exact value as well., (*6)
<?php
$text = \Faker\Factory::create()->words(650, true);
// returns 3.25
(new EstimatedReadingTime)
->exactTime(true)
->setText($text)
->calculateTime();
// returns 3
(new EstimatedReadingTime)
->setText($text)
->calculateTime();
Check CHANGELOG for the changelog, (*7)
To run tests use, (*8)
$ composer test
If you discover any security related issues, please email your@mail.tld or use the issue tracker of GitHub., (*9)
Aheenam is a small company from NRW, Germany creating custom digital solutions. Visit our website to find out more about us., (*10)
The MIT License (MIT). Please see License File for more information., (*11)
Calculate the reading time for any given webpage
MIT
Calculate the reading time for any given webpage
MIT