Skip to content

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.

432 B
Raw Blame
<?php

declare(strict_types=1);

namespace App\Support\Analytics;

class EngagementRate
{
    /** Engagements per exposure (reach, else impressions, else views), in percent. */
    public static function of(mixed $engagements, mixed $exposure): ?float
    {
        if ($engagements === null || (int) $exposure <= 0) {
            return null;
        }

        return round((int) $engagements / (int) $exposure * 100, 2);
    }
}