honeystone/reading-time

A very simple reading time calculator for PHP.

1.1.0 2024-07-29 01:05 UTC

This package is auto-updated.

Last update: 2024-11-27 17:32:28 UTC


README

Static Badge GitHub License Latest Version on Packagist Packagist Dependency Version Static Badge

Use this very simple reading time package to calculate the expected reading time for any given body of text.

Support us

Support Us

We are committed to delivering high-quality open source packages maintained by the team at Honeystone. If you would like to support our efforts, simply use our packages, recommend them and contribute.

If you need any help with your project, or require any custom development, please get in touch.

Installation

composer require honeystone/reading-time

Usage

//average reading time
reading_time($text); //5m

//fast reading time
reading_time()->fast($text) //4m

//slow reading time
reading_time()->slow($text) //6m

//include seconds
reading_time(config: ['seconds' => true]); //5m 10s

//longform
reading_time(config: ['short' => false]); //5 minutes

//configure globally
reading_time()->configure(['short' -> false], true);

//all available config & defaults
reading_time()->configure([
    'slowWpm' => 180,
    'averageWpm' => 240,
    'fastWpm' => 320,
    'additionalCharacters' => '',
    'seconds' => false,
    'format' => null,
    'short' => true,
    'countHtml' => false,
]);

Changelog

A list of changes can be found in the CHANGELOG.md file.

License

MIT © Honeystone Consulting Ltd