icawebdesign/reading-time

Calculate indication of length of time to read an article

1.2.0 2022-10-02 13:07 UTC

This package is auto-updated.

Last update: 2024-11-27 03:17:14 UTC


README

Latest Stable Version Total Downloads License

Requirements

  • PHP 7.2.0+

Installation

composer require icawebdesign/reading-time

Usage

// Return number of minutes
$readingTime = new ReadingTime();
$minutes = $readingTime->minutes($string); // eg: 5
// Return minutes with suffix
$readingTime = new ReadingTime();
$readingLength = $readingTime->minutesWithSuffix($string); // eg: 5 minute read
// Change reading speed (default: 250 words-per-minute)
$readingTime = new ReadingTime(400);
$minutes = $readingTime->minutes($string);
// Change suffix string
$readingTime = new ReadingTime();
$readingLength = $readingTime->minutesWithSuffix($string, 'mins reading');

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email ian.h@digiserv.net instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.