Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
<?php
declare(strict_types=1);
namespace App\Services\Post\ExternalMedia;
use App\Dto\RemoteFile;
use App\Models\SocialAccount;
use Illuminate\Support\Facades\Http;
abstract class AbstractMediaResolver implements ExternalMediaResolver
{
public function callsProvider(): bool
{
return true;
}
/**
* @param array<string, mixed> $query
* @return array<string, mixed>
*/
protected function getJson(SocialAccount $account, string $url, array $query = [], bool $authenticated = true): array
{
$request = Http::acceptJson()->timeout(60);
return (array) ($authenticated ? $request->withToken($account->access_token) : $request)
->get($url, $query)
->throw()
->json();
}
/**
* @param iterable<mixed> $urls
* @return list<RemoteFile>
*/
protected function remoteFiles(iterable $urls): array
{
return collect($urls)
->filter(fn (mixed $url): bool => is_string($url) && $url !== '')
->map(fn (string $url): RemoteFile => RemoteFile::fromUrl($url))
->values()
->all();
}
}