illuma-law / laravel-social-caster
A standalone Laravel package for social media publishing.
Package info
github.com/eloquage/laravel-social-caster
pkg:composer/illuma-law/laravel-social-caster
Requires
- php: ^8.3
- illuminate/contracts: ^11.0||^12.0||^13.0
- illuminate/database: ^11.0||^12.0||^13.0
- illuminate/support: ^11.0||^12.0||^13.0
- saloonphp/laravel-plugin: ^3.0||^4.0
- saloonphp/saloon: ^3.0||^4.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.1
- laravel/pint: ^1.21
- mrpunyapal/peststan: ^0.2.12
- nunomaduro/collision: ^8.6
- orchestra/testbench: ^10.1
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- spatie/laravel-ray: ^1.39
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-23 14:03:21 UTC
README
Publish content to supported social platforms through one Laravel API. The package validates content and account compatibility before making platform requests.
Requires PHP 8.3+ and Laravel 11, 12, or 13. Supported platforms are X, LinkedIn, Facebook, Instagram, Threads, and TikTok. Each platform requires its own developer application, access scopes, and credentials.
Install
composer require illuma-law/laravel-social-caster php artisan vendor:publish --tag=social-caster-config
Implement the contracts
Your content object implements PublishableContent; your account model
implements SocialCredentials. Keep access tokens in protected storage and
return the token and provider metadata from the credential methods.
use Illuma\SocialCaster\Facades\SocialCaster; // $post and $account are your application objects implementing the contracts. $errors = SocialCaster::validate($post, $account); if ($errors !== []) { throw new InvalidArgumentException(implode(' ', $errors)); } $result = SocialCaster::publish($post, $account); // Store the platform response details returned by the API. $externalId = $result->externalId; $rawResponse = $result->rawResponse;
PublishableContent supplies a platform, body, title, optional image/video,
and metadata. SocialCredentials supplies the platform, access tokens,
provider user ID, and provider-specific metadata. Publishing errors are thrown
as exceptions; handle them in your queue or application boundary.
Configure limits
The published config/social-caster.php file controls preflight character
limits and LinkedIn's default visibility. Use it to tune content validation
for your application's publishing rules.
Test
composer test
composer analyse
vendor/bin/pint --test
MIT licensed. See LICENSE.
