A Laravel package for fetching, storing, and displaying Instagram feeds with Filament integration. This package provides an efficient way to manage Instagram content within your Laravel application.
- OAuth authentication with Instagram
- Support for multiple Instagram profiles
- Fetch and store Instagram feed data
- Store Instagram posts and media as Eloquent models
- Display and manage Instagram feeds in Laravel Filament admin panel
- Automatic conversion of images to WebP format for improved performance
You can install the package via composer:
composer require cnrp/laravel-instagram-feed
The package will automatically register its service provider.
The package comes with a default configuration file. If you need to customize these settings, you can publish the config file:
php artisan vendor:publish --tag="instagram-feed-config"
This will create a config/instagram-feed.php
file in your app's configuration directory. The default configuration looks like this:
<?php
return [
'client_id' => env('INSTA_CLIENT'),
'client_secret' => env('INSTA_SECRET'),
'redirect_uri' => env('INSTAGRAM_REDIRECT_URI', 'auth/instagram/callback'),
'debug' => [
'log_info' => env('INSTAGRAM_FEED_LOG_INFO', true),
'log_errors' => env('INSTAGRAM_FEED_LOG_ERRORS', true),
],
];
client_id
: Your Instagram API client ID.client_secret
: Your Instagram API client secret.redirect_uri
: The URI to redirect to after Instagram authentication. Default is 'auth/instagram/callback'.debug
:log_info
: Whether to log informational messages.log_errors
: Whether to log error messages.
Make sure to set the appropriate values in your .env
file:
INSTA_CLIENT=your_client_id
INSTA_SECRET=your_client_secret
This package provides a Filament page for managing your Instagram feeds. You can access it at /admin/instagram-manager
.
- Navigate to the Instagram Manager page in your Filament admin panel.
- Click on "Add New Profile" to authenticate with Instagram.
- Once authenticated, you can view and manage multiple Instagram profiles and their feeds.
- Use the "Refresh Feed" button to manually update the feed for a selected profile.
To publish the styles for the Instagram Manager page, run the following command
php artisan filament:assets
You can also use the package programmatically:
use CNRP\InstagramFeed\Facades\InstagramFeed;
// Get a profile
$profile = \CNRP\InstagramFeed\Models\InstagramProfile::find($profileId);
// Refresh the feed for a profile
InstagramFeed::refreshFeed($profile);
// Get the feed for a profile
$feed = InstagramFeed::getFeed($profile);
The package provides the following Eloquent models:
InstagramProfile
: Represents an authenticated Instagram profileInstagramPost
: Represents an individual Instagram postInstagramMedia
: Represents media (images/videos) associated with posts
You can interact with these models using standard Eloquent operations.
Images are automatically converted to WebP format when stored, improving load times and optimizing storage usage.
- Scheduled refreshing of auth tokens and fetching feed
- Call api/download in batches
- Customizable front-end components
- Configurable compression settings/disable conversion
- Hide posts
This package is open-sourced software licensed under the MIT license.
If you encounter any issues or have questions, please open an issue on GitHub.