thoughtco / statamic-instagram
Requires
- php: ^8.2
- pgrimaud/instagram-user-feed: ^7.0
- pixelfear/composer-dist-plugin: ^0.1.5
- statamic/cms: ^4.0 || ^5.0
Requires (Dev)
- laravel/pint: ^1.13
- mockery/mockery: ^1.3.1
- nunomaduro/collision: ^6.0 || ^7.0
- orchestra/testbench: ^7.0 || ^8.0
- pestphp/pest: ^2.24
- phpunit/phpunit: ^9.0 || ^10.0
README
Statamic Instagram lets you pull down users media and profiles from within your Statamic site.
How to Install
Run the following command from your project root:
composer require thoughtco/statamic-instagram
Configuration
A configuration file can be published by running the following command:
php artisan vendor:publish --tag=statamic-instagram-config
This will create statamic-instagram.php
in your config folder.
Usage
This package provides a light wrapper around https://github.com/pgrimaud/instagram-user-feed, which uses web scraping to get Instagram posts. This means you don't need to set up a Facebook or Instagram App to access it.
It requires an Instagram username and password to pull down data - you should create a throwaway Instagram account for this rather than using an actual account. Add the username and password to your .env:
STATAMIC_INSTAGRAM_USERNAME
and STATAMIC_INSTAGRAM_PASSWORD
.
Tag
This package provides an {{ instagram }}
tag:
{{ instagram profile="robertdowneyjr" limit="6" as="ig" }} <div> {{ ig }} {{ media }} <a href="{{ link }}" > <img src="{{ thumbnailSrc }}" alt="{{ caption }}" /> </a> {{ /media }} {{ /ig }} </div> {{ /instagram }}
API
This package exposes the API provided by the instagram-user-feed package, so you can call any of the methods on it, eg:
app(\Instagram\Api::class)->getProfile('robertdowneyjr');