1. Go to this page and download the library: Download ivkos/wallhaven library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ivkos / wallhaven example snippets
use Wallhaven\Category;
use Wallhaven\Order;
use Wallhaven\Purity;
use Wallhaven\Sorting;
use Wallhaven\Wallhaven;
$wh = new Wallhaven();
$wh = new Wallhaven('YOUR_USERNAME', 'YOUR_PASSWORD');
// Get favorites count for the first wallpaper in the list
$wallpapers[0]->getFavorites();
// Print resolutions of all wallpapers in the list
foreach ($wallpapers as $w) {
echo $w->getResolution() . PHP_EOL;
}
// Get the number of wallpapers in the list
echo "There are " . $wallpapers->count() . " wallpapers!" . PHP_EOL;
use Wallhaven\Wallhaven;
use Wallhaven\WallpaperList;
$wh = new Wallhaven();
$batch = new WallpaperList();
$batch[] = $wh->wallpaper(198320);
$batch[] = $wh->wallpaper(103929);
$batch->downloadAll("/home/user/wallpapers");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.