ronnie/tra-crawler
Composer 安装命令:
composer require ronnie/tra-crawler
包简介
A package to crawl TRA web receipts and return the data in necessary format
README 文档
README
TRA Crawler
A PHP package for crawling TRA receipts and returning its data as a collection, array or json.
Badges
Add badges from somewhere like: shields.io
Installation
Install TRA crawler with composer.
composer require ronnie/tra-crawler
The project also make use of puppeteer to access JS content on the receipt.
npm install puppeteer
Authors
Usage/Examples
Plain PHP
When using this package in plain PHP, a simple setup like this can help you get started:
use Ronnie\TRA\Crawler; ... $crawler = new Crawler(); // For URI or QR Scanned receipts you can use the URI method $receipt = $crawler->setUri($yourURI)->crawl(); // For Physical receipt, Receipt verification code and the time is to be used in conjuction with the code method $receipt = $crawler->setCode($yourCode, $yourTime)->crawl();
Do note that the time ($yourTime) should be in hhMMss format (124453).
Laravel / Dependency Injection
When using this package in a Laravel/Symfony Project or any project that has a DI container, a better solution would be to use the container to inject an instance of the Ronnie\TRA\Crawler class into whatever class or method you need. A singleton works best for such scenarios.
It is also possible to extend the Ronnie\TRA\Crawler class or write your own implementation as long as they obey the Ronnie\TRA\Contracts\ResourceCrawler contract/interface.
Run Locally
Clone the project
git clone https://github.com/RonnieTaz/tra-crawler
Go to the project directory
cd tra-crawler
Install NPM dependencies
npm install puppeteer
Install Composer dependencies
composer install
Use CLI app to test output
php bin/console app:test-output -i url -u the_receipt_url
Also, few sample receipts have been added to the project to simplify testing. Head over to config.php to set which sample you want to use.
ronnie/tra-crawler 适用场景与选型建议
ronnie/tra-crawler 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 45 次下载、GitHub Stars 达 3, 最近一次更新时间为 2022 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ronnie/tra-crawler 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ronnie/tra-crawler 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2022-10-30