承接 vdhicts/read-time 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vdhicts/read-time

最新稳定版本:v4.0.0

Composer 安装命令:

composer require vdhicts/read-time

包简介

Laravel package to determine the time required to read a text

关键字:

README 文档

README

Laravel package to determine the read time of a text.

Requirements

This package requires at least Laravel 11+ and PHP 8.2 or newer.

Installation

You can install the package via composer:

composer require vdhicts/read-time

Usage

This package can be used multiple ways. When the content contains HTML, the HTML is stripped before calculating the read time.

Helper

The helper returns the amount of minutes (as integer) it should take for the reader to read the text.

read_time($text);
read_time($text, $wordPerMinute);

Blade

The blade directive returns the amount of minutes (as integer) it should take for the reader to read the text.

@readTime($text)
@readTime($text, $wordPerMinute)

Direct usage

The class offers a bit more functionality.

use Vdhicts\ReadTime\ReadTime;

$readTime = new ReadTime($text);
// OR $readTime = new ReadTime($text, $wordsPerMinute);
$readTime->minutes(); // the amount of minutes (as integer) it should take to read
$readTime->seconds(); // the amount of seconds (as integer) it should take to read
$readTime->wordCount(); // the amount of words (as integer) found in the text

Custom configuration

Publish the configuration with:

php artisan vendor:publish --provider="Vdhicts\ReadTime\ReadTimeServiceProvider"

Tests

Unit tests are available in the tests folder. Run with:

composer test

When you want a code coverage report which will be generated in the build/report folder. Run with:

composer test-coverage

Contribution

Any contribution is welcome, but it should meet the PSR-12 standard and please create one pull request per feature/bug. In exchange, you will be credited as contributor on this page.

Security

If you discover any security related issues in this or other packages of Vdhicts, please email security@vdhicts.nl instead of using the issue tracker.

Support

If you encounter a problem with this package or has a question about it, feel free to open an issue on GitHub.

License

This package is open-sourced software licensed under the MIT license.

About Vdhicts

Vdhicts is the name of my personal company for which I work as freelancer. Vdhicts develops and implements IT solutions for businesses and educational institutions.

统计信息

  • 总下载量: 17.81k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-06