承接 somarkn99/estimated-reading-time 相关项目开发

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

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

somarkn99/estimated-reading-time

Composer 安装命令:

composer require somarkn99/estimated-reading-time

包简介

A simple package to calculate and display estimated reading time in both Arabic and English.

README 文档

README

Latest Version on Packagist Total Downloads

This package provides a simple way to calculate and display the estimated reading time for content in both Arabic and English.

Installation

You can install the package via composer:

composer require somarkn99/estimated-reading-time

A Wordpress version of this package is available as a plugin here

Usage

Service Provider

Add the service provider to the providers array in config/app.php:

'providers' => [
    // Other Service Providers
    Somarkn99\EstimatedReadingTime\EstimatedReadingTimeServiceProvider::class,
],

Configuration

You can publish the configuration file using this command:

php artisan vendor:publish --provider="Somarkn99\EstimatedReadingTime\EstimatedReadingTimeServiceProvider" --tag="config"

This will publish the estimatedreadingtime.php configuration file to the config directory.

Blade Directive

You can use the Blade directive to display the estimated reading time in your views:

@readingtime($content, 'en')

Or for Arabic content:

@readingtime($content, 'ar')

Directly Using the Main Class

You can directly call the calculate method from the EstimatedReadingTime class in your controllers, commands, or other parts of your application:

use Somarkn99\EstimatedReadingTime\EstimatedReadingTime;

$readingTime = EstimatedReadingTime::calculate($content, 'en');

API Usage

If you prefer to use an API to get the estimated reading time, you can use the provided endpoint.

Define the Route

Ensure the route is loaded by including it in your routes/api.php:

Route::prefix('api')->group(function () {
    require base_path('vendor/somarkn99/estimated-reading-time/src/routes/api.php');
});

Make a Request

Send a POST request to /api/reading-time with the content and language in the request body.

Request:

POST /api/reading-time
Content-Type: application/json

{
    "content": "Your article content goes here...",
    "lang": "en"
}

Response:

{
    "reading_time": "Estimated Time of Reading: 3 Min"
}

Configuration Options

You can customize the package by modifying the configuration options:

return [
    'ar_prefix' => 'الوقت المقدر للقراءة: ',
    'ar_suffix_s' => 'دقيقة',
    'ar_suffix_p' => 'دقائق',
    'en_prefix' => 'Estimated Time of Reading: ',
    'en_suffix' => 'Min',
    'en_wpm' => 300,
    'ar_wpm' => 250,
    'exclude_images' => true,
];

Security

If you discover any security-related issues, please email kesen.somar.99@gmail.com instead of using the issue tracker.

Credits

License

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

somarkn99/estimated-reading-time 适用场景与选型建议

somarkn99/estimated-reading-time 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 6, 最近一次更新时间为 2024 年 06 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「package」 「laravel」 「english」 「arabic」 「reading time」 「estimated reading time」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 somarkn99/estimated-reading-time 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 somarkn99/estimated-reading-time 我们能提供哪些服务?
定制开发 / 二次开发

基于 somarkn99/estimated-reading-time 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-15