coderdojo/delorean
Composer 安装命令:
composer require coderdojo/delorean
包简介
PHP Console app that downloads screenshots from the Internet Archive Wayback Machine
README 文档
README
This PHP command line (console) app allows you to generate screenshots of websites from the past and present, courtesy of Wayback Machine by The Internet Archive.
Installation
Install this application through Composer.
If you don't have Composer installed yet, run
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
Once you have Composer, you can install the app an it's depencies with
composer create-project coderdojo/delorean
Alternatively, if you prefer to clone this Git repository, you can install the dependencies only with the following (inside the app root).
composer install
Requirements
This package is designed to work with PHP >= 5.6 over the command line.
Usage
Generate Screenshots
You can generate a past and present screenshot of a specific website by using the command: php delorean screenshot <url> [--years=10]
In other words,
php delorean screenshot http://google.com
will generate a screenshot for the present day, plus one from the past using the default number of years (which is 10).
To change the number of years ago for the past screenshot, you can pass this as an option.
php delorean screenshot http://google.com --years=5
How it Works
The delorean file in the project root is a command line php script that registers a new Symfony console application, currently with one command.
The src/ScreenshotCommand.php file contains the code that is run when you put php delorean screenshot http://google.com in the command line. Have a look in this file to check the process of getting the URL and number of years. The getSnapshotUrl() method in this file connects to the Wayback Machine API to find the right URL for the past copy of the website.
The src/ScreenshotGenerator.php file contains the code that takes a screenshot. Because this is contained within it's own PHP class / file, we can re-use this in future by just including it from wherever it's needed. See Wikipedia - DRY.
Finally, this ap makes use of a number of Open-source projects. These are listed below:
- Symfony Console - Used to register a command-line app and get input from the user.
- Symfony Process - Component used to run other command line processes from our code.
- PhantomJs - A 'headless' browser that we use to load up webpages and take screenshots in our code.
- Guzzle - A great HTTP client used to 'talk' to the Wayback Machine API.
- Carbon - A simple PHP DateTime helper that makes working with timestamps super easy.
TODO
- [] Update to check if URL exists before taking past/present screenshots
- [] Add command option to only generate past screenshot (rather than present and past)
- [] New command to take multiple past screenshots at the one time
Why Delorean?
In the feature film series Back to the Future, Dr. Emmett Brown builds a time machine based on an automobile; a DeLorean DMC-12.
Futher Reading.
- Open-source packages listed above
- How to Build Command-Line Apps video series on Laracasts.com
Credits / License
Made by David Rushton, Developer at Papertank Limited Using the MIT License
coderdojo/delorean 适用场景与选型建议
coderdojo/delorean 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 31 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 10 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 coderdojo/delorean 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 coderdojo/delorean 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-21