svenpetersen/instagram

Fund package maintenance!
www.paypal.me/svenharders

Installs: 1 885

Dependents: 1

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 3

Open Issues: 9

Type:typo3-cms-extension

v4.0.1 2024-12-03 13:31 UTC

README

StandWithUkraine TYPO3 10 TYPO3 11 Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

TYPO3 Extension "instagram"

What does it do?

TYPO3 Extension to import and display instagram posts/feeds in a TYPO3 Website.

Creates and auto-refreshes long-lived api access tokens, imports instagram feeds/posts as entities to the database and output feeds/posts via Frontend-Plugin.

  • >= V3.x of this extension uses the "Instagram API with Instagram Login" App and API.
  • <= V2.x uses the "Instagram Basic Display API" which will reach its EOL on Dec 4th 2024.

Summary of features

  • Backend module for easy creation of long-lived API access tokens
  • Automatic refreshing of API access tokens to keep them valid
  • Import multiple Instagram users feeds/posts
  • Uses official "Instagram API with Instagram Login" to access a users feed.
  • Provides commands to refresh access tokens and to import feeds via cronjob/scheduler
  • Downloads the posts (images/videos). No API calls needed when displaying them = no frontend performance impact.
  • Display users feeds/posts in any way you like
  • Based on Extbase and Fluid

Installation

The recommended way to install the extension is by using Composer. In your Composer based TYPO3 project root, just do:

composer require svenpetersen/instagram

Setup

  1. Include the provided static TypoScript
  2. Create a Facebook "Instagram API with Instagram Login" App: See the official Documentation for a step by step guide
  3. Use the Backend Module provided by this Extension to create a "long-lived access token" in a "Feed" Entity.
  4. Execute the command instagram:import:posts {username} {storagePid} [limit|25] to import the posts from a given users feed
  5. Add a Frontend-Plugin on a page to output the imported posts in the frontend.

Recommended:

  • Add a cronjob/scheduler task to refresh the API Access tokens automatically - see "Automatic Access Token refresh" for details.
  • Add a cronjob/scheduler task to import the posts on a regular basis

Compatibility

Funtionalities

Automatic import of posts

This extension comes with a command to import (new) posts of a given instagram user. It is recommended to set this command up to run regularly - e.g. once a day.

instagram:import:posts {username} {storagePid} [limit|25] [--since="01/01/2022 00:00:00" --until="12/31/2022 23:59:59"
]

Arguments:

Options:

Automatic Access Token Refreshing

The generated long-lived access token is valid for 60 days. It can be refreshed when at least 24 hours old.

To handle automatic refreshing of your access tokens this extension provides the command

instagram:accesstoken:refresh-all

Make sure to run this command regularly - e.g. once a day via a cronjob/scheduler - in order to keep your access token valid.

Disable/enable Backend module "Token Generator"

To disable the Backend module - e.g. after you generated all needed tokens - add this line to the LocalConfiguration.php/AdditionalConfiguration.php:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['instagram.tokenGeneratorBeModule'] = false;

Extending

Additional Template Selector

If you need a kind of template selector inside a plugin, you can add your own selections by adding those to:

$GLOBALS['TYPO3_CONF_VARS']['EXT']['instagram']['templateLayouts']['myext'] = ['My Title', 'my value'];

Local path to save downloaded files

By default all images/videos in imported posts are saved in /public/fileadmin/instagram You can change this path via the Extensions settings local_file_storage_path option.

Events

This extension comes with a few events for you to listen to and add your own logic:

UPGRADE

v2.x to v3.x

Since the "Instagram Basic Display API" will reach it's EOL an Dec. 4th 2024 the underlaying mechanism for generating access tokens changes. It is now required to have a "Instagram Professional Account". Any regular Instagram account can be converted into a professional account via the Profile Settings.

You then have to use the "Instagram Token Generator" Backend Module and re-run the token generation process. This extension will then update your exsiting Feed Entity with a new access token.

There are no changes to the database model, templates or plugins. All your existing customizations etc. will work like before.

Contributing

Please refer to the contributing document included in this repository.

Testing

This Extension comes with a testsuite for coding styles and unit/functional tests. To run the tests simply use the provided composer script:

composer ci:test