Skip to content
CLI to download photos from unsplash.com
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build
cli
src
tests
.gitignore
.travis.yml
Dockerfile
LICENSE
README.md
composer.json
composer.lock
create-phar.php
phpunit.xml
screenshot.png

README.md

unsplash-downloader

Unsplash image

CLI to download photos from unsplash.com

Status

Build Status Code Coverage Scrutinizer Code Quality SensioLabsInsight

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 !

Usage

Download photos :

unsplash-downloader [--destination DESTINATION] [--quantity QUANTITY] [--history HISTORY] [--featured]
unsplash-downloader [--destination DESTINATION] [--quantity QUANTITY] [--history HISTORY] [--category CATEGORY]
unsplash-downloader [--categories]

Executable

The executable is located into the build directory.

Requirements

Dependency : PHP 5.5+ or 7 or hhvm.

Options

--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


Build from source

Get sources

git clone git@github.com:simondubois/unsplash-downloader.git

Install dependencies

cd unsplash-downloader/
composer install

Make your changes

	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

Run tests

vendor/bin/phpunit

Test coverage can be found under tests/coverage.

Build PHAR

php create-phar.php

The generated PHAR can be found under build.

You can’t perform that action at this time.