Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Google Analytics Api Symfony Laravel Package

mediafigaro/google-analytics-api-symfony

A Symfony bundle that integrates the Google Analytics API, providing configuration and services to query analytics data from your Symfony application. Simplifies authentication and reporting setup.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

A Symfony bundle wrapping the Google Analytics API remains a reasonable architectural shape for server-side reporting in a monolith: one bundle registration, one configuration tree, one injectable client service, credentials managed through the container rather than scattered through application code. That is still the right pattern for a Symfony application that needs scheduled reporting, dashboard aggregation, or ETL pulls from GA into a local store.

Release 1.2 sharpens the picture on two points. First, it confirms the API surface: the release notes promise metrics, dimension, and sorting support "as from" ga-dev-tools.appspot.com/query-explorer, which is the Universal Analytics Core Reporting API (v3) request model. UA properties stopped processing hits in July 2023 and that reporting surface is decommissioned, so the bundle's core purpose is obsolete as shipped — 1.2 is a query-builder enhancement on a dead endpoint, not a migration to the GA4 Data API. Second, it materially raises the bundle's functional value: the package is not merely DI sugar, it wraps the official client with a report-request builder (metric/dimension selection, sort clauses, presumably date ranges and filters). That is real code worth reading, and worth extracting. It does not, however, change the framework baseline — the release notes make no claim about Symfony 6/7, PHP 8.1+, or google/apiclient current major.

Verdict: architecturally conventional and now slightly more substantive than a pure service definition, but still aimed at a decommissioned API and a two-major-version-old framework baseline. Release 1.2 improves the code we might borrow; it does not improve the case for adopting the dependency.

Integration feasibility

Mechanically simple: add to config/bundles.php, supply credentials (service account JSON or OAuth refresh token), specify a view/profile ID, inject the client, pass metrics/dimensions/sort. For a Symfony 4 application already on google/apiclient v2, this is an afternoon of work — and 1.2's sort support removes the main reason to drop to the raw client for ranked reports.

In practice, feasibility is still gated by Composer resolution. Nothing in the 1.2 notes indicates relaxed constraints; expect symfony/framework-bundle pinned to ^3.4|^4.0, google/apiclient at ^2.0, and transitive Guzzle/PSR constraints that collide with current dependencies. Expect to fork with relaxed constraints or vendor the handful of classes that matter.

Technical risk — HIGH (unchanged)

  • API lifecycle risk (dominant): 1.2 targets the UA Query Explorer surface, which is decommissioned. Any integration that "works" may return empty result sets silently rather than erroring — the worst failure mode for a reporting pipeline.
  • Abandonment — slightly improved, not resolved: a 1.2 release shows the repository is not entirely dormant, which softens the "no activity since 2018" characterization. But 46 stars, 0 dependents, no published changelog, no dated release metadata in the notes, and no stated support commitment still mean no security triage and no compatibility policy you can plan against.
  • Dependency decay: conflicting transitive constraints, unpatched Guzzle advisories, PHP 8 incompatibilities. 1.2 gives no evidence of a PHP 8 or Symfony 6 test matrix.
  • Credential handling: bundles of this vintage frequently default to service-account JSON paths in YAML, encouraging checked-in credentials. Confirm; treat as a remediation item, not something to inherit.
  • Quota coupling: 1.2 adds expressiveness (dimensions, sorting) without adding throttling, caching, or backoff. More expressive queries against a quota-bound API means more ways to burn budget, with the burden still on the caller.
  • Ambiguous scope in the release notes: "simple wrapper to start with" undersells and underspecifies. There is no statement of what changed, what broke, or what minimum versions moved.

Key questions to resolve before committing engineering time

  1. Does 1.2 change the client construction at all, or only the request builder? Read the diff, not the notes.
  2. Which API surface is called today — UA Reporting v3, UA Reporting v4, or GA4 Data API? 1.2's Query Explorer reference strongly implies UA v3; confirm in code.
  3. Is 1.2 tagged with a date and a changelog entry, and does it move any minimum version (PHP, Symfony, google/apiclient)?
  4. Does it support service-account auth, or only OAuth 2.0 three-legged flow?
  5. How separable is the report-request builder from the bundle packaging? If it is a self-contained class with no container coupling, extraction cost is low and the case for forking improves.
  6. Any CI, tests, or static analysis added in 1.2? Any active forks tracking it?
  7. Is the intended use case GA4 (wrong tool entirely) or historical UA backfill (data likely no longer retrievable at all)?

Integration Approach

Stack fit

Dimension 1.2 presumes (inferred) Current target
Symfony 3.4 / 4.x 6.x / 7.x
PHP 7.0–7.2 8.1+
Google client google/apiclient v2 (UA) google/analytics-data (GA4)
Auth service account / OAuth2 service account, workload identity
Config YAML tree + DI extension attributes / env vars / secrets manager
Query capability metrics, dimensions, sorting (1.2) GA4 dimensions/metrics/orderBys

Net: does not fit a modern stack without modification, but 1.2 raises the salvage value of the source.

Migration path

Three viable options, in ascending order of effort:

  1. Replace, don't adopt (recommended). Build a thin service around google/analytics-data for GA4, or google/apiclient directly for any remaining historical UA access. Use 1.2's request builder as the design reference for the GA4 equivalent — the metric/dimension/sort vocabulary maps cleanly onto GA4's orderBys.
  2. Fork and strip (now more attractive than before). 1.2's builder is the first genuinely non-trivial code in the package. Extract the builder and client service into application code, drop the bundle packaging, relax the constraint pins, and own it. This is a smaller lift than it was against the pre-1.2 baseline.
  3. Adopt as-is for a legacy Symfony 3/4 app. Only defensible if a frozen application must keep reading a still-live, non-UA Google property, and even then the 2018-era dependency tree should be security-reviewed.

Compatibility work required if forking

  • Relax composer.json constraints; verify against google/apiclient current major.
  • Convert service definitions to modern Symfony (autowire/autoconfigure, AbstractBundle or Bundle::getContainerExtension(): ?ExtensionInterface).
  • Move credentials to environment/secret manager; remove any committed JSON.
  • Replace the config tree with plain config or a symfony/config v6 tree builder.
  • Add PHP 8 type declarations and a smoke test against a live property.
  • Port the 1.2 sort/dimension handling into the extracted builder and add unit tests for query assembly — this is now the highest-value piece to carry forward.

Sequencing

  1. Spike (1–2 days, extended slightly to cover the 1.2 diff): read the source, confirm the API surface, diff 1.2 against the prior release to see whether the builder is extractable, attempt authentication against a real property. Gate on whether data returns at all — this single check can terminate the evaluation.
  2. Decide replace vs fork vs adopt based on spike output, extractability of the builder, and whether GA4 is in scope.
  3. Prototype the replacement (or the extracted builder) in parallel with any existing reporting path; do not cut over.
  4. Parallel run for one reporting cycle, comparing outputs and quota consumption.
  5. Cut over and delete the bundle dependency.

If the spike confirms the target API is UA and decommissioned, skip to step 3 — but salvage the 1.2 query builder as the reference implementation for the GA4 replacement.

Operational Impact

Maintenance

Still the decisive factor. A 1.2 release proves the codebase is not frozen, which is a genuine improvement over "last published 2018," but it does not constitute a maintenance surface: no changelog discipline, no stated compatibility policy, no visible CI, no security response path, 46 stars and 0 dependents. Adopting means the adopting team becomes the maintainer — fork or absorb. Budget for that explicitly; it remains a "take ownership of the library" decision, not a "use the library" decision, though the thing being owned is now more useful than a bundle registration.

Support

No vendor SLA. Issue response is best-effort by an organization with a sparse publishing record. Internal knowledge will rest on whoever performed the spike. Mitigate by documenting the extracted builder, its query contract, and the GA4 mapping in-repo.

Scaling

Reporting remains quota-bound, not compute-bound: per-project daily quotas and per-request concurrency limits on the Google side. 1.2's added expressiveness — more dimensions, more sort clauses, wider date ranges — increases per-request cost and the odds of hitting limits, and the bundle still almost certainly ships no caching, batching, exponential backoff, or quota-aware scheduling. All are mandatory beyond low-volume dashboards. Plan a local cache/store (reporting pulls are idempotent and highly cacheable) and an async job for large ranges. Chunk historical backfills by date and schedule off-peak.

Failure modes

Failure Symptom Mitigation
Decommissioned API Empty/zero result sets, no exception Validate non-empty assertions; alert on zero rows for expected-nonzero reports
Quota exhaustion (more likely with 1.2's richer queries) 429s, silent throttling Backoff, request budget, caching
Credential expiry / rotation Auth errors on schedule Secret manager + rotation runbook, startup health check
Token refresh race Intermittent 401s under concurrency Single-flight token refresh
Dependency conflict at install Composer resolution failure Fork with relaxed pins, or vendor code
PHP 8 incompatibility Fatal at autoload/instantiation Static analysis pass before adoption
Undocumented 1.2 behavior change Query shape or sort ordering differs from prior release Diff the release, pin the version, snapshot-test query assembly
Unpatched transitive CVE Security finding in SCA scan Fork + bump, or replace

The silent-empty-result mode remains the one to design against; reporting failures that look like "no traffic" are more damaging than loud errors. The new entry is release opacity — an undocumented behavior change in a query builder is easy to miss and hard to diagnose downstream.

Ramp-up

Learning the bundle is still trivial — a day for a Symfony-fluent engineer, plus half a day to absorb the 1.2 metric/dimension/sort API. The real effort is building the production scaffolding the package omits (caching, quota management, credential rotation, alerting on empty results) and, if replacing, mapping the UA query vocabulary onto GA4's orderBys and dimension/metric names. Budget one to two engineer-weeks for a production-grade reporting path regardless of fork or replace; 1.2 trims perhaps two days off that if the builder extracts cleanly.

Recommendation

Do not adopt as a dependency. Release 1.2 makes the package a better reference implementation — a working metric/dimension/sort request builder wired into Symfony's container — and that is exactly how to use it. Extract the builder, port it to the GA4 Data API, and own the lifecycle. The package's value has moved from "a DI pattern" to "a small, portable query builder"; its viability as a maintained integration has not moved at all.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle