CLI to download photos from unsplash.com
This application is now considered as stable. No more features are planned, but feel free to suggest some if you need. Any help is welcome !
Download photos :
unsplash-downloader [--destination DESTINATION] [--quantity QUANTITY] [--history HISTORY] [--featured]
unsplash-downloader [--destination DESTINATION] [--quantity QUANTITY] [--history HISTORY] [--category CATEGORY]
unsplash-downloader [--categories]
The executable is located into the build directory.
Dependency : PHP 5.5+ or 7 or hhvm.
--destination DESTINATION
Directory where to download photos. Default: current working directory
--quantity QUANTITY
Number of photos to download. Default: 10
--history HISTORY
Filename to use as download history. When photos are downloaded, their IDs will be stored into the file. Then any further download is going to ignore photos that have their ID in the history. Usefull to delete unwanted pictures and prevent the CLI to download them again. Default: none
--featured
Download only featured photos (incompatible with the --category option). Default: false
--category CATEGORY
Only download photos for the given category ID (incompatible with the --featured option). Default: none
--categories
Print out categories and quit (no download). Default: false
git clone [email protected]:simondubois/unsplash-downloader.git
cd unsplash-downloader/
composer install
cli/index.php
CLI stub. Initial script to define application commands and run it.
src/Application.php
An Application is the container for a collection of commands. It is the main entry point of a Console application. This class is optimized for a standard CLI environment.
src/Download.php
A download command to handle the whole process to download photos. Steps are :
- check option validity (destination, count and history).
- create a task (to deal with Unsplash API).
- execute the task.
src/Task.php
A task to download photos from Unsplash. Steps are
- list photos
- download photos
src/Unsplash.php
A proxy to deal with the Unsplah API :
- list photos
src/History.php
A proxy to handle history operations like :
- loading history from file
- checking existence of entity in history
- appending data to history
- saving history to file
vendor/bin/phpunit
Test coverage can be found under tests/coverage
.
php create-phar.php
The generated PHAR can be found under build
.