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\Support;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
final class RequestIds
{
/**
* The value when it is a uuid, else null: an id read from a link's query is
* ignored when malformed instead of failing the page (PostgreSQL refuses a
* non-uuid in a uuid column).
*/
public static function uuid(mixed $value): ?string
{
return Str::isUuid($value) ? $value : null;
}
/**
* @param Collection<int, mixed> $values
* @return list<string>
*/
public static function uuidList(Collection $values): array
{
return $values
->filter(fn (mixed $value): bool => is_string($value) && Str::isUuid($value))
->values()
->all();
}
/**
* The requested ids that are among the allowed ones, in the allowed order; anything else is dropped silently.
*
* @param Collection<int, mixed> $requested
* @param Collection<int, string> $allowedIds
* @return list<string>
*/
public static function selected(Collection $requested, Collection $allowedIds): array
{
return $allowedIds->intersect(self::uuidList($requested))->values()->all();
}
}