Download the PHP package iliain/silverstripe-insta without Composer
On this page you can find all versions of the php package iliain/silverstripe-insta. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iliain/silverstripe-insta
More information about iliain/silverstripe-insta
Files in iliain/silverstripe-insta
Package silverstripe-insta
Short Description Provides Instagram login code and feed collector for Silverstripe
License BSD-3-Clause
Homepage http://github.com/Iliain/silverstripe-insta
Informations about the package silverstripe-insta
Silverstripe Instagram
Code for Silverstripe that interacts with the Express auth app. This is designed to query the app found here and will not function without it. The code is designed to provide a login link, store incoming tokens, and use said tokens to request feed information from the Basic Display API, nothing more.
Installation (with composer)
composer require iliain/silverstripe-insta
Config
You'll need to define the following variables in your config:
auth_handler_url
is used to define the URL where the auth app is located, while cache_file
simply determines the name assigned to the local cache file for the feed.
Usage
Once configured, the code will add a new section to the site Settings in the CMS. Users can use this to log in and authorise an account, which will then store an access token. From here, you can then use the InstagramCacheTask to query the Basic Display API for you and retrieve some posts, which will then be stored in a local file in the public directory. A limit can be included, but is optional.
You can use code like the following example to pull this data into the frontend:
The fields available to display are the following:
- ID
- Username
- Caption (stored as a Text DBField)
- Link
- Image (returns thumbnail_url if present, defaults to media_url if not)
- Timestamp (stored as a Datetime DBField)