Skip to content

Simple package for displaying read time

License

Notifications You must be signed in to change notification settings

leepownall/read-time

Repository files navigation

Read Time

Latest Version on Packagist Tests Total Downloads

Simple package for displaying read time.

Installation

You can install the package via composer:

composer require leepownall/read-time

Usage

Using get()

$readTime = new Pownall\ReadTime\ReadTime('Hello, world!');

$readTime->get();

Using __toString()

$readTime = new Pownall\ReadTime\ReadTime('Hello, world!');

echo $readTime;

Using blade directive

@readtime('Hello, world!')

Pass in wordsPerMinute

$readTime = new Pownall\ReadTime\ReadTime('Hello, world!', 300);
@readtime('Hello, world!', 300)

Output

It uses Carbon under the hood, specifically forHumans on the CarbonInterval.

The output looks like

2 hours 4 minutes

Config

Default wordsPerMinute is 200. You can override this by passing it in, or publish the config and override there.

php artisan vendor:publish --tag=readtime-config

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

About

Simple package for displaying read time

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages