# Read Time Calculator for Laravel

By Dinesh Uprety
Published: 2024-07-09
Updated: 2024-07-09
Canonical: https://laranepal.com/blog/read-time-calculator-for-laravel

## Read Time Calculation helper function
Let's look at an example: The following code is a simple helper function that can calculate the time (in seconds) it takes for a person to read a string passed as an argument:

```php
function calculate_read_time(string $words): int
{
	return (int) ceil(
			(Str::wordCount($words) / 265) * 60
	);
}
```
