PHPackages                             illuma-law/laravel-social-caster - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. illuma-law/laravel-social-caster

ActiveLibrary[API Development](/categories/api)

illuma-law/laravel-social-caster
================================

A standalone Laravel package for social media publishing.

v0.1.4(1mo ago)062MITPHPPHP ^8.3CI passing

Since Apr 20Pushed 1mo agoCompare

[ Source](https://github.com/illuma-law/laravel-social-caster)[ Packagist](https://packagist.org/packages/illuma-law/laravel-social-caster)[ RSS](/packages/illuma-law-laravel-social-caster/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (17)Versions (6)Used By (0)

Laravel Social Caster
=====================

[](#laravel-social-caster)

[![Latest Version on Packagist](https://camo.githubusercontent.com/104b6e5a556300d216a3a8d3de3da8836254164704eb6bd8850c4beb7d93fc4c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696c6c756d612d6c61772f6c61726176656c2d736f6369616c2d6361737465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/illuma-law/laravel-social-caster)[![GitHub Tests Action Status](https://camo.githubusercontent.com/24c2eacd709a49678e16348e3ddc18c201f0c03c76b7b10c6aa5ad9af0a46e4f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696c6c756d612d6c61772f6c61726176656c2d736f6369616c2d6361737465722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/illuma-law/laravel-social-caster/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/afffd14527b197c9b0eacb9275b5afcfdae96582f8852fb2abceec66049c87bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696c6c756d612d6c61772f6c61726176656c2d736f6369616c2d6361737465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/illuma-law/laravel-social-caster)

A standalone Laravel package providing an elegant, unified API for publishing content to multiple social media platforms.

Instead of wrestling with half a dozen different SDKs, API documentation sites, and conflicting payload structures, Social Caster provides a single, uniform interface to broadcast content to Twitter, LinkedIn, Facebook, Instagram, Threads, and TikTok.

Features
--------

[](#features)

- **Unified Interface:** Publish text, images, and videos across multiple networks using a single `publish()` method.
- **Contract-Driven:** Implement `PublishableContent` on your Models (like a `Post` or `Tweet` model) and `SocialCredentials` on your auth models to decouple business logic from the API.
- **Built-in Validation:** Validates character limits, required media, and platform-specific constraints before making any network calls.
- **Supported Platforms:**
    - Twitter (X)
    - LinkedIn (Profiles and Organization Pages)
    - Facebook (Pages)
    - Instagram
    - Threads
    - TikTok

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require illuma-law/laravel-social-caster
```

Publish the config file:

```
php artisan vendor:publish --tag="social-caster-config"
```

Configuration
-------------

[](#configuration)

The published `config/social-caster.php` defines platform-specific constraints and defaults:

```
return [
    // Pre-flight validation checks will fail if content exceeds these limits
    'char_limits' => [
        'twitter' => 280,
        'linkedin' => 3000,
        'facebook' => 63206,
        'instagram' => 2200,
        'threads' => 500,
        'tiktok' => 2000,
    ],
    'linkedin' => [
        'default_visibility' => 'PUBLIC', // PUBLIC or CONNECTIONS
    ],
];
```

Usage &amp; Integration
-----------------------

[](#usage--integration)

### 1. Define Publishable Content

[](#1-define-publishable-content)

Any model or DTO you wish to publish must implement the `PublishableContent` contract. This tells Social Caster exactly what to send to the platform.

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuma\SocialCaster\Contracts\PublishableContent;
use Illuma\SocialCaster\Enums\SocialPlatform;

class BlogPost extends Model implements PublishableContent
{
    // Ensure the model knows which platform it targets
    public function getSocialPlatform(): SocialPlatform
    {
        return SocialPlatform::Twitter;
    }

    public function getPublishableBody(): ?string
    {
        return $this->social_caption; // e.g., "Check out our new post! #laravel"
    }

    public function getPublishableTitle(): ?string
    {
        return $this->title;
    }

    public function getPublishableImagePath(): ?string
    {
        // Must be a publicly accessible URL or local path depending on the platform
        return $this->header_image_url;
    }

    public function getPublishableVideoUrl(): ?string
    {
        return null;
    }

    public function getPublishableMetadata(): array
    {
        return [];
    }
}
```

### 2. Define Social Credentials

[](#2-define-social-credentials)

The account or token storage model must implement the `SocialCredentials` contract so Social Caster knows how to authenticate the request.

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuma\SocialCaster\Contracts\SocialCredentials;
use Illuma\SocialCaster\Enums\SocialPlatform;

class SocialAccount extends Model implements SocialCredentials
{
    public function getSocialPlatform(): SocialPlatform
    {
        return SocialPlatform::from($this->provider_name); // 'twitter', 'linkedin', etc.
    }

    public function getSocialAccessToken(): ?string
    {
        return $this->oauth_token;
    }

    public function getSocialPublishingAccessToken(): ?string
    {
        // Used by platforms that require a separate token for publishing (e.g. FB Pages)
        return $this->page_access_token ?? $this->oauth_token;
    }

    public function getSocialProviderUserId(): ?string
    {
        // The external platform's ID for this user/page
        return $this->provider_user_id;
    }

    public function getSocialMetadata(): array
    {
        // Extra auth tokens (like Twitter secrets) can be passed here
        return [
            'token_secret' => $this->oauth_token_secret,
            'client_id' => config('services.twitter.client_id'),
            'client_secret' => config('services.twitter.client_secret'),
        ];
    }
}
```

### 3. Validation and Publishing

[](#3-validation-and-publishing)

You can now use the `SocialCaster` facade to validate and publish the content.

```
use Illuma\SocialCaster\Facades\SocialCaster;

$post = BlogPost::find(1);
$account = SocialAccount::where('provider_name', 'twitter')->first();

// 1. Validate first (Optional but recommended)
$errors = SocialCaster::validate($post, $account);

if (!empty($errors)) {
    // Returns an array of error strings (e.g. ["Content exceeds 280 characters"])
    return back()->withErrors($errors);
}

// 2. Publish
$result = SocialCaster::publish($post, $account);

if ($result->successful) {
    $post->update(['external_social_id' => $result->externalId]);
    echo "Successfully published! ID: {$result->externalId}";
} else {
    // $result->error contains the API error message
    Log::error("Failed to publish", ['error' => $result->error]);
}
```

Testing
-------

[](#testing)

The package provides a comprehensive Pest test suite to ensure API connectors handle payloads correctly.

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance91

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

5

Last Release

44d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2affac64f2726a640084b203503518ca01f582536d60a0a299b614486ed95aaa?d=identicon)[miguelenes](/maintainers/miguelenes)

---

Top Contributors

[![miguelenes](https://avatars.githubusercontent.com/u/1568086?v=4)](https://github.com/miguelenes "miguelenes (11 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/illuma-law-laravel-social-caster/health.svg)

```
[![Health](https://phpackages.com/badges/illuma-law-laravel-social-caster/health.svg)](https://phpackages.com/packages/illuma-law-laravel-social-caster)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1122.7k](/packages/codebar-ag-laravel-docuware)[codebar-ag/laravel-zammad

Zammad integration with Laravel

116.7k](/packages/codebar-ag-laravel-zammad)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
