putheakhem/laravel-social-stats

Fetch follower/subscriber stats from various social media platforms.

v1.1.3 2025-04-04 04:30 UTC

This package is auto-updated.

Last update: 2025-05-26 11:08:32 UTC


README

Latest Version Total Downloads License

A Laravel package to fetch follower/subscriber counts from various social media platforms including Telegram, YouTube, and Facebook Pages.

✨ Features

  • 📊 Get real-time follower counts from:
    • Telegram Channels
    • YouTube Channels
    • Facebook Pages
    • Instagram Followers (via connected Facebook Page)
    • TikTok Followers
  • ⚡ Built Support Laravel 11+ & PHP 8.2+
  • 🔒 Caching with Laravel’s new Cache::flexible()
  • 🧹 Facade support: SocialStats::platform('telegram')

📦 Installation

composer require putheakhem/laravel-social-stats

Ensure you’ve configured your Laravel app to support package discovery.

⚙️ Configuration

Publish the config file:

php artisan vendor:publish --tag=config

Set the following in .env:

YOUTUBE_API_KEY=your_youtube_api_key
FACEBOOK_ACCESS_TOKEN=your_facebook_access_token
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
INSTAGRAM_ACCESS_TOKEN=your_instagram_access_token
INSTAGRAM_PAGE_ID=your_instagram_business_account_id

🔧 Usage

use SocialStats;

// Telegram
SocialStats::platform('telegram')->fetchCount('your_channel_username'); // No @ symbol

// YouTube
SocialStats::platform('youtube')->fetchCount('UCxxxxxxx'); // Channel ID

// Facebook Page
SocialStats::platform('facebook')->fetchCount('your_page_id'); // Page ID Number (3127652********)

// Instagram (uses page_id to discover linked Instagram account)
SocialStats::platform('instagram')->fetchCount('fintechcenterfsa'); // Instagram username

// TikTok
SocialStats::platform('tiktok')->fetchCount('your_tiktok_username'); // TikTok username

The package uses Laravel’s built-in HTTP and cache systems.

✅ Supported Platforms

  • ✅ Telegram Channels Subscribers
  • ✅ YouTube Channels Subscribers
  • ✅ Facebook Page Likes
  • ✅ Instagram Followers (via connected Facebook Page)
  • ✅ TikTok Follower
  • ⏳ Twitter Follower (planned)

🔪 Testing

To run tests:

composer test

Support Me

If you find this package useful, consider supporting my work:

📄 License

The MIT License (MIT). Please see License File for more information.

💡 Contributing

Feel free to submit PRs or open issues for suggestions and improvements.