pownall / read-time
Simple package for displaying read time
Fund package maintenance!
leepownall
Requires
- php: ^8.2
- illuminate/contracts: ^10.0|^11.0
- nesbot/carbon: ^2.0
- spatie/laravel-package-tools: ^1.0
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: *
- pestphp/pest: ^2.15
- spatie/ray: ^1.28
This package is auto-updated.
Last update: 2024-04-29 12:16:28 UTC
README
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 good, 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.