This package adds an Instagram post model to your Laravel application, for a cool feed or something like this.
The package relies on the vinkla/instagram
package, and adds a solution to cache and a model
You can install the package via composer:
composer require retinens/laravel-instagram
Then run the migrations used for caching, as the API is limited to 200 calls/hour.
php artisan migrate
First you need to generate an access token using Pixel Union's access token generator or by creating an Instagram application.
Put this API key in your .env file
INSTAGRAM_KEY=YOUR_KEY
You can run the command to update the cache.
php artisan laravel-instagram:refresh
NOTE : you have to run the Laravel Scheduler in background to use this package. This package adds a command which is executed every 10 minutes to update the cache. More info about the Laravel scheduler
To retrieve all posts use the facade : (this is limited to the latests)
LaravelInstagram::getPosts()
You can specify a number of post to get, it will get the most recents ones :
LaravelInstagram::getPosts(4)
This returns a collection with all the posts stored.
On each post, you can get attributes:
// Full Size Image
$post->standardResolutionImageUrl
// Caption text
$post->captionText
// HTML formatted caption text (use {!! !!} to escape <br> tags)
$post->htmlCaptionText
// Link to the post
$post->link
The MIT License (MIT). Please see License File for more information.