jeffersongoncalves/laravel-metrics-plausible
Laravel Metrics Plausible brings Plausible Analytics stats into your Laravel app, with a simple, fluent API to fetch pageviews, visitors, and other metrics for dashboards, reporting, and monitoring. Lightweight, easy to configure.
Architecture fit: v1.0.0 is a Laravel-native client for Plausible Analytics, with a facade, StatsQuery builder, enums, typed exceptions, and settings integration via spatie/laravel-settings. This fits Laravel applications that need Plausible stats or site/goal management without building and maintaining a custom HTTP client. The package supports common product and marketing reporting needs: aggregate metrics, time series, breakdowns, pages, sources, countries, devices, goals, custom events, and realtime visitors. It also covers site provisioning and goal management, which is useful for internal tooling or multi-site admin workflows.
Integration feasibility: The package is straightforward to adopt for a Laravel 11/12/13 application on PHP 8.2+. Configuration is environment-driven through PLAUSIBLE_API_KEY, PLAUSIBLE_SITE_ID, and PLAUSIBLE_BASE_URL, with settings seeded through spatie/laravel-settings. The facade and ready-made methods reduce implementation effort for common dashboards and reports, while StatsQuery supports custom metrics, dimensions, filters, ordering, pagination, imports, and time labels. Because this is the first release, there is no migration burden from a prior package version, but there is also no established production track record.
Technical risk: The main risks are first-release maturity and mixed API surface. Stats use Plausible API v2, while sites and goals use v1 endpoints; self-hosted Community Edition behavior may differ from Plausible Cloud. The release documents typed exceptions for authentication and rate limits, but it does not state retry/backoff behavior, caching strategy, pagination ergonomics, or observability hooks. API key handling and settings caching should be reviewed. Laravel 13 compatibility is declared, but the team should verify it against the actual application version and dependency constraints.
Key questions:
spatie/laravel-settings introduce deployment or cache-clear requirements?Stack fit: This package fits Laravel applications that need embedded analytics, internal reporting dashboards, marketing performance views, content analytics, goal conversion reporting, or lightweight site/goal administration. It is best used behind application services or jobs rather than called directly from views, so caching, retries, and authorization can be centralized. TPMs can leverage it for product dashboards, acquisition reporting, content performance, and campaign tracking without owning a custom Plausible integration.
Migration path: There is no prior package version to migrate from. For teams with existing custom Plausible API calls, introduce the package alongside existing code, compare outputs for key metrics, and migrate one report or endpoint at a time. Keep the old integration as a fallback until the new package is validated in staging. For greenfield use, install, configure environment variables, publish settings if required, and start with read-only stats before enabling site or goal management.
Compatibility: Confirm PHP 8.2+, Laravel 11/12/13, and spatie/laravel-settings compatibility in the target application. Validate the self-hosted Plausible version and base URL path if using Community Edition. Because the package mixes Stats API v2 and Sites/Goals API v1, test both read-only analytics and management endpoints separately. Check that API keys have the minimum required permissions and that site IDs are correct per environment.
Sequencing:
PLAUSIBLE_API_KEY, PLAUSIBLE_SITE_ID, and PLAUSIBLE_BASE_URL per environment.sites or site.aggregate, timeseries, and selected breakdown methods.pages, sources, countries, and goalConversions.StatsQuery only for custom reports that the ready-made methods do not cover.Maintenance: Low to moderate. The package reduces custom integration code, but it is a first release and should be version-pinned and monitored. Track upstream Plausible API changes, package releases, Laravel/PHP upgrades, and spatie/laravel-settings updates. Maintain a small internal owner for configuration, API key rotation, and dependency upgrades.
Support: Typed exceptions improve supportability for authentication, rate-limit, and general Plausible failures. Teams should document common failure causes: missing API key, invalid site ID, insufficient permissions, self-hosted base URL misconfiguration, and rate limiting. Provide a runbook for rotating keys and validating connectivity. Because the package is new, internal support may need to compensate for limited public production evidence.
Scaling: The primary scaling constraint is the Plausible API and its rate limits, not the Laravel package itself. Cache dashboard queries, avoid realtime polling except where necessary, move heavy reporting into queued jobs, and reuse settings per environment. Multi-site or multi-tenant usage will require careful configuration management and likely an application-level abstraction for per-tenant API keys and site IDs.
Failure modes: Watch for 401/403 authentication failures, 429 rate limits, network timeouts, Plausible 5xx responses, malformed base URLs, missing site IDs, settings cache issues, and API version drift between v1 and v2 endpoints. Self-hosted Community Edition may expose different behavior than Cloud. Dashboards should degrade gracefully, show cached or stale data where acceptable, and alert on repeated API failures.
Ramp-up: Low for Laravel developers familiar with facades and service configuration. Moderate for teams using self-hosted Plausible, multi-tenant site management, or custom StatsQuery reporting. TPMs should define the initial metric set, site mapping, access model, caching expectations, and acceptance criteria before implementation. A staged rollout with read-only analytics first is the lowest-risk adoption path.
How can I help you explore Laravel packages today?