PHP code example of pyrsmk / streams
1. Go to this page and download the library: Download pyrsmk/streams 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/ */
pyrsmk / streams example snippets
$stream = new Streams\Facebook\Album('10150205173893951', [
'api' => '*****',
'secret' => '*****',
'limit' => 50
]);
$stream->get()->then(function($elements) {
// Print all retrieved images
foreach($elements as $element) {
echo "<img src=\"{$element['source']}\" alt=\"{$element['title']}\">";
}
// calling wait() is needed only if you want to wait
// for the request to complete before continue the script
})->wait();
[
'type' => 'text',
'date' => integer,
'author' => string,
'avatar' => string,
'title' => string,
'description' => string,
'permalink' => string
]
[
'type' => 'image',
'date' => integer,
'author' => string,
'avatar' => string,
'title' => string,
'description' => string,
'permalink' => string,
'source' => string,
'width' => integer,
'height' => integer,
'mimetype' => string
]
[
'type' => 'video',
'date' => integer,
'author' => string,
'avatar' => string,
'title' => string,
'description' => string,
'permalink' => string,
'source' => string,
'width' => integer,
'height' => integer,
'mimetype' => string,
'preview' => [
'source' => string,
'width' => integer,
'height' => integer
]
]
[
'type' => 'embed',
'date' => integer,
'author' => string,
'avatar' => string,
'title' => string,
'description' => string,
'permalink' => string,
'html' => string,
'width' => integer,
'height' => integer,
'preview' => [
'source' => string,
'width' => integer,
'height' => integer
]
]
new Streams\FileSystem\Directory('some/path/', [
'limit' => 50
]);
new Streams\DeviantArt\Category('photography/nature', [
'api' => '*****',
'secret' => '*****',
'nsfw' => false,
'limit' => 50,
// either 'newest', 'hot', 'undiscovered', 'popular',
// 'popular8h' (default), 'popular24h', 'popular3d', 'popular1w' or 'popular1m'
'type' => 'newest'
]);
new Streams\DeviantArt\User('numyumy', [
'api' => '*****',
'secret' => '*****',
'nsfw' => false,
'limit' => 50
]);
new Streams\Dribbble\Bucket('476346-Usabilty-examples', [
'token' => '*****',
'limit' => 50
]);
new Streams\Dribbble\Project('280804-Graphics', [
'token' => '*****',
'limit' => 50
]);
new Streams\Dribbble\Team('Creativedash', [
'token' => '*****',
'limit' => 50
]);
new Streams\Dribbble\User('BurntToast', [
'token' => '*****',
'limit' => 50
]);
new Streams\Facebook\Album('1710763805841434', [
'api' => '*****',
'secret' => '*****',
'limit' => 50
]);
new Streams\Facebook\Album('ChatNoirDesign', [
'api' => '*****',
'secret' => '*****',
'limit' => 50
]);
new Streams\Facebook\Album('ChatNoirDesign', [
'api' => '*****',
'secret' => '*****',
'limit' => 50,
'type' => 'uploaded'
]);
new Streams\Facebook\Videos('ChatNoirDesign', [
'api' => '*****',
'secret' => '*****',
'limit' => 50
]);
new Streams\Facebook\Notes('289941984496813', [
'api' => '*****',
'secret' => '*****',
'limit' => 50
]);
new Streams\FiveHundredPx\User('ademgider', [
'api' => '*****',
'nsfw' => false,
'limit' => 50
]);
new Streams\FiveHundredPx\Gallery('ademgider/city-map', [
'api' => '*****',
'nsfw' => false,
'limit' => 50
]);
new Streams\Flickr\User('cannon_s5_is', [
'api' => '*****',
'limit' => 50
]);
new Streams\Flickr\Album('cannon_s5_is/72157625103228853', [
'api' => '*****',
'limit' => 50
]);
new Streams\GooglePlus\People('+frandroid', [
'api' => '*****',
'limit' => 50
]);
new Streams\Instagram\User('ademgider/city-map', [
'limit' => 20
]);
new Streams\Reddit\Subreddit('earthporn', [
'nsfw' => false,
'limit' => 50,
// either 'popular', 'new' (default), 'rising', 'controversial', 'top' or 'gilded'
'type' => 'new'
]);
new Streams\Reddit\User('hansiphoto', [
'nsfw' => false,
'limit' => 50
]);
new Streams\Vimeo\Category('food', [
'api' => '*****',
'secret' => '*****',
'nsfw' => false,
'limit' => 50
]);
new Streams\Vimeo\Channel('comedy', [
'api' => '*****',
'secret' => '*****',
'nsfw' => false,
'limit' => 50
]);
new Streams\Vimeo\Group('animation', [
'api' => '*****',
'secret' => '*****',
'nsfw' => false,
'limit' => 50
]);
new Streams\Vimeo\User('loispatino', [
'api' => '*****',
'secret' => '*****',
'nsfw' => false,
'limit' => 50
]);
new Streams\Youtube\Channel('UCCMxHHciWRBBouzk-PGzmtQ', [
'api' => '*****',
'limit' => 50
]);
new Streams\Youtube\Playlist('PLWmL9Ldoef0sKB07aXA1ekfyIqu-47rV6', [
'api' => '*****',
'limit' => 50
]);
// Add Facebook
$streams[] = function() {
$stream = new Streams\Facebook\Album('10150205173893951', [
'api' => '*****',
'secret' => '*****',
'limit' => 50
]);
return $stream->get()->then(function($elements) {
// Print all retrieved images
foreach($elements as $element) {
echo "<img src=\"{$element['source']}\" alt=\"{$element['title']}\">";
}
});
};
// Add Flickr
$streams[] = function() {
$stream = new Streams\Flickr\Album('cannon_s5_is/72157625103228853', [
'api' => '*****',
'limit' => 50
]);
return $stream->get()->then(function($elements) {
// Print all retrieved images
foreach($elements as $element) {
echo "<img src=\"{$element['source']}\" alt=\"{$element['title']}\">";
}
});
};
// Add Instagram
$streams[] = function() {
$stream = new Streams\Instagram\User('ladylikelilymusic');
return $stream->get()->then(function($elements) {
// Print all retrieved images
foreach($elements as $element) {
echo "<img src=\"{$element['source']}\" alt=\"{$element['title']}\">";
}
});
};
// Run requests
$guzzle = new GuzzleHttp\Client(['verify' => false]);
$pool = new GuzzleHttp\Pool($guzzle, $streams);
$pool->promise()->wait();