Get easily any Unsplash images with a clean PHP class.
It's a really lightweight and simple PHP class that helps you to get easily any images from Unsplash.com while keeping your project clean.
use PH7\Image\Unsplash;
$unsplash = new Unsplash();
$unsplash->setWidth(600)
->setHeight(400)
->setQuality(80)
->setImageId('photo-1462045504115-6c1d931f07d1');
echo '<img src="' . $unsplash->getImage() . '">';
$unsplash->setImageId('photo-1500045992661-f978470eaf7b');
$unsplash->setFit(Unsplash::MAX_FIT);
echo '<img src="' . $unsplash->getImage() . '">';
- Install Composer (https://getcomposer.org)
- Include it in your project:
composer require ph-7/image-unsplash
- PHP 7.1 or higher
- Composer
Made with ♥ and care by Pierre-Henry Soria
MIT License. Enjoy! 😃