Download the PHP package hojabbr/laravel-social without Composer
On this page you can find all versions of the php package hojabbr/laravel-social. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hojabbr/laravel-social
More information about hojabbr/laravel-social
Files in hojabbr/laravel-social
Package laravel-social
Short Description Driver-based social publishing and analytics for Laravel: Instagram, YouTube and Telegram behind one three-state publish contract.
License MIT
Homepage https://github.com/hojabbr/laravel-social
Informations about the package laravel-social
Laravel Social
Driver-based social publishing and analytics for Laravel: Instagram, YouTube and Telegram behind one contract, resolved the way Laravel resolves a disk or a queue connection.
Three outcomes
publish() never throws. Every driver maps its network's failures onto:
| Outcome | Meaning | Caller |
|---|---|---|
Sent |
The object exists. | Record its id. |
Rejected |
The network refused; nothing was created. | Release the claim; a corrected retry is safe. |
Unknown |
Timeout, dropped connection, ambiguous 5xx; it may exist. | Keep the claim and surface it; never blind-retry. |
The boundary is where the object starts to exist: a failed Instagram container is Rejected, a dropped
connection during media_publish is Unknown.
Requirements
- PHP 8.5+, Laravel 13
irazasyed/telegram-bot-sdk^3.15 for the Telegram driverspatie/image^3.8, optional, for spec-compliant Telegram video thumbnails
Install
Publish the whole config and keep it whole: mergeConfigFrom merges only the first level, so nested keys
you delete are not backfilled and new nested keys need a re-publish.
Configuration
networks are transports (credentials, API bases, queue lanes); accounts are places to post.
- Account keys are your vocabulary (locale, brand, tenant); a single identity uses
default. - A network names its driver, so two networks can share one driver class.
- Per-account credentials (
token,refresh_token) live on the account; app-wide ones (Meta app secret, Google client, bot token) on the network.tokenandrefresh_tokenare separate so a rotation writing the access token cannot overwrite the grant. - A network with no account for a key is simply not a target for it.
- The package never reads
env()directly.
Publishing
bodyis the one text field;titleexists for networks with a second one.tagscarry no#; each driver spends them its network's way.mediais in reading order; several items are an album or carousel, andexternalIdslists every object (externalIdis the first). A deletion must walk all of them.Capabilities::$pullsMediasays whether the network fetches a URL (Instagram) or takes bytes (Telegram, YouTube).
Capabilities
Drivers refuse media whose mime type is not listed, before sending.
Optional contracts
Check with instanceof; a driver implements one only when its network has the feature.
| Contract | Implemented by |
|---|---|
SupportsDeletion |
Telegram, YouTube |
SupportsCoverUpdate |
YouTube |
SupportsMediaReplacement (new file and caption in the same post) |
Telegram |
SupportsComments (write-only: reply, hide, delete) |
|
SupportsTopics |
Telegram |
ProvidesAnalytics |
Instagram, YouTube |
RefreshesTokens |
Instagram, YouTube |
Instagram cannot delete posts, replace a Reel's cover or its video on an Instagram-Login token, and its comment read API returns an empty list, so there is no read method.
Analytics
Every method returns Metrics, a flat bag of values, including on failure (Metrics::unavailable()).
toArray() / fromArray() are the cache-safe shape.
Token refresh
The driver renews and returns credentials; persisting them is yours. Then drop the memoised driver.
Rate and health
Spacing is per account and counts messages: Telegram's ~20 per minute is per chat, and an album spends one slot per page.
Testing
Repeated willReturn() calls queue in order and the last repeats; unusable() makes the network look
switched off. Run the package's own suite with composer test.
Adding a network
Implement Contracts\Driver (extend Drivers\BaseDriver for config, accounts and destination()), plus
the optional contracts your network supports, and add a network entry naming the driver.
Network notes
- Instagram (Instagram Login,
graph.instagram.com): container, poll, publish, permalink. Meta pulls media, containers expire in 24 hours,image_urlmust be JPEG, at most 5 hashtags inside the 2200-character caption. ReadpublishingLimit()before a burst. Token renewal sends the token in the query string. - YouTube: OAuth refresh, resumable upload (the session URI is in the
Locationheader), thumbnail, reads.access_type=offlineplusprompt=consentreturns a refresh token. Deletion needs theyoutube.force-sslscope. An unaudited Google Cloud project uploads as private only. - Telegram: ~20 messages a minute per chat. The 50 MB limit covers the whole request (the driver caps
at 45 MB). Nested Bot API objects must be JSON-encoded.
show_caption_above_mediamust match on every album item. A bot deletes its own messages only within 48 hours, but edits them at any age:replaceMedia()swaps the file througheditMessageMediaand sends the caption again, which Telegram otherwise clears.
License
MIT. See LICENSE.md.
All versions of laravel-social with dependencies
illuminate/contracts Version ^13.0
illuminate/http Version ^13.0
illuminate/process Version ^13.0
illuminate/support Version ^13.0