Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Read Time Laravel Package

mtownsend/read-time

Laravel package that estimates the read time of any text or article. It counts words, lets you customize words per minute, and returns a clean "X minute read" value—ideal for blog posts, docs, and content-heavy pages.

View on GitHub
Deep Wiki
Context7

mtownsend/read-time is a lightweight PHP package for calculating the estimated reading time of a piece of text. It is useful for blogs, documentation, and CMS-driven sites that want to show readers how long an article will take, using a configurable words-per-minute rate.

  • Estimate reading time from plain text or HTML
  • Adjust reading speed to match your audience
  • Simple, expressive API for quick integration
  • Works well in Laravel and other PHP applications
  • Lightweight and easy to add to existing content workflows
Frequently asked questions about Read Time
How do I install mtownsend/read-time in a Laravel app?
Install it with Composer using composer require mtownsend/read-time. In Laravel, check whether the package supports package discovery so the facade or helper is available automatically; otherwise register the service provider manually. Before committing, verify the package's PHP and Laravel constraints against your application.
Does mtownsend/read-time support Laravel 10 and PHP 8.2?
The last release was January 2021, so support for Laravel 10 and PHP 8.2 is not guaranteed. Run Composer in a branch and check platform requirements before adopting it. If constraints conflict, fork under an internal namespace or reimplement the small word-count calculation as a first-party service.
Does mtownsend/read-time strip HTML and Markdown correctly?
The package's core behavior is to strip HTML, count words, and estimate reading time. Markdown is riskier because syntax characters and code blocks can affect word counts, so test representative content. If accuracy matters, pre-render Markdown to HTML or normalize content before passing it in.
Can I configure words per minute in mtownsend/read-time?
Yes, the reading estimate is based on a configurable words-per-minute rate. Set the WPM to match your audience and content type rather than relying on a generic default. Centralize that configuration in your app so views and API responses stay consistent.
What does mtownsend/read-time return, minutes or a formatted string?
It returns a readable reading-time estimate derived from word count and WPM, not analytics or raw word statistics. Confirm the exact return shape in a spike before wiring it into Blade templates or API resources. If you need minutes, seconds, or localized labels, format the output in your own presenter.
Does mtownsend/read-time handle Unicode, CJK, or non-Latin content?
Unicode and CJK content are a known risk because simple word-count logic may not handle non-Latin word boundaries well. Test with real samples, including mixed-language and code-heavy articles, before relying on the estimate. If results are poor, wrap or replace the calculation with a Unicode-aware implementation.
Is mtownsend/read-time safe to use in production if it has not been updated since 2021?
Functional risk is low because the calculation is simple, but dependency risk is moderate because upstream has not released since 2021. Pin the version, run composer audit, and wrap calls behind an internal interface so you can swap implementations later. MIT licensing makes forking or reimplementing low-risk if the package blocks a framework upgrade.
How should I test reading time calculations for empty or malformed content?
Add unit tests for empty strings, malformed HTML, Markdown, Unicode text, code blocks, and long-form articles. Assert that the calculator returns a sensible minimum or zero without errors and that output stays stable behind your adapter. Include one integration test for the Blade or API surface that consumes the estimate.
Can I use mtownsend/read-time outside Laravel in plain PHP?
Yes, it is a PHP package and can be used outside Laravel with a small adapter, assuming its Composer constraints fit your runtime. The value is highest in Laravel projects that already use Composer, facades, and Blade. In plain PHP, consider copying the simple word-count and WPM logic instead of adding a stale dependency.
What alternatives or migration path exist if mtownsend/read-time is abandoned?
Define a ReadingTimeCalculator interface in your application and implement it with an adapter around mtownsend/read-time. That keeps views, controllers, and API resources independent so you can later swap in an in-house word-count/WPM calculator or another maintained package. Treat the package as an MVP accelerator and document the fallback before rollout.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource