philipnewcomer/linkify-tracking
Composer 安装命令:
composer require philipnewcomer/linkify-tracking
包简介
Linkifies package tracking numbers for DHL, FedEx, UPS, and USPS
README 文档
README
Linkifies package tracking numbers for DHL, FedEx, Royal Mail (UK), UPS, and USPS.
Installation
composer require philipnewcomer/linkify-tracking
Usage
First instantiate an instance of the library:
$linkifyTracking = new PhilipNewcomer\LinkifyTracking\LinkifyTracking;
Get the tracking URL for a single tracking number
$linkifyTracking->getLinkUrl('12345678901234567890');
Result:
https://tools.usps.com/go/TrackConfirmAction?tLabels=12345678901234567890
Get the link data for a single tracking number
$linkifyTracking->getLinkData('12345678901234567890');
Result:
[
'carrier' => 'USPS',
'url' => 'https://tools.usps.com/go/TrackConfirmAction?tLabels=12345678901234567890'
]
Convert all tracking numbers in the given content to HTML links
$content = ' Here is a tracking number: 12345678901234567890 And another tracking number: 12345678901234567890 '; $linkifyTracking->linkify($content)
Result:
Here is a tracking number: <a href="https://tools.usps.com/go/TrackConfirmAction?tLabels=12345678901234567890">12345678901234567890</a> And another tracking number: <a href="https://tools.usps.com/go/TrackConfirmAction?tLabels=12345678901234567890">12345678901234567890</a>
Configuration
Configuration arguments may be passed to the LinkifyTracking constructor.
The following arguments may be provided:
linkAttributes: An array of attributes which should be added to the generated HTML links
Example:
$linkifyTracking = new PhilipNewcomer\LinkifyTracking\LinkifyTracking([ 'linkAttributes' => [ 'class' => 'tracking-link', 'target' => '_blank' ] ]);
Credits
Tracking number regular expressions for DHL, FedEx, UPS, and USPS are taken from https://github.com/darkain/php-tracking-urls.
philipnewcomer/linkify-tracking 适用场景与选型建议
philipnewcomer/linkify-tracking 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 48.08k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2018 年 05 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 philipnewcomer/linkify-tracking 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 philipnewcomer/linkify-tracking 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 48.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2018-05-24