Weave Code
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

Metrics Laravel Package

directorytree/metrics

Record and query metrics in Laravel with a simple, elegant API. Track page views, API calls, signups, and other countable events. Supports values, categories, custom attributes, hourly/dated metrics, model-based tracking, and Redis storage.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. Buy: Justifies a "buy" decision for analytics/metrics infrastructure, reducing development time for custom solutions.
  • Roadmap Prioritization: Enables rapid implementation of feature flags, A/B testing, and user behavior tracking without heavy backend investment.
  • Use Cases:
    • Growth Metrics: Track signups, conversions, and retention (e.g., metric('signups')->record()).
    • API/Performance Monitoring: Segment API calls by endpoint (metric('api:requests')->category('users')->record()).
    • Model-Specific Analytics: Associate metrics with Eloquent models (e.g., metric('orders')->measurable($customer)->record()).
    • Custom Segmentation: Add attributes like source, country, or device for granular insights.
    • Batch Processing: Offload high-volume metrics to Redis for bulk commits (e.g., hourly API requests).

When to Consider This Package

  • Adopt if:
    • Your Laravel app needs lightweight, structured metrics without heavyweight tools (e.g., Mixpanel, Amplitude).
    • You require daily/hourly granularity with optional custom attributes (e.g., tracking user actions by segment).
    • Your team lacks dedicated analytics engineers but needs self-service querying (e.g., Metric::thisMonth()->where('name', 'purchases')->sum('value')).
    • You want to reduce database load via Redis batching for high-traffic scenarios.
  • Look elsewhere if:
    • You need real-time dashboards (consider Laravel Scout + third-party tools).
    • Your metrics require complex event streams (e.g., Kafka, custom time-series DBs).
    • You’re already using a dedicated analytics platform (e.g., Snowplow, PostHog) and need tight integrations.
    • Your app isn’t Laravel-based (though PHP compatibility exists).

How to Pitch It (Stakeholders)

For Executives: "This package lets us track critical business metrics (signups, conversions, API usage) without building a custom system—saving 3–6 months of dev time. It’s lightweight, scalable (supports Redis for high traffic), and integrates seamlessly with our Laravel stack. We can start measuring growth, debugging performance, and segmenting user behavior immediately with minimal overhead."

For Engineering: *"DirectoryTree/Metrics provides a batteries-included solution for structured analytics:

  • Simple API: Record metrics in one line (metric('signups')->record()).
  • Flexible Querying: Filter by date, category, or custom attributes (e.g., Metric::thisMonth()->where('source', 'google')->sum('value')).
  • Performance Optimized: Redis-backed batching reduces DB load for high-volume apps.
  • Extensible: Add custom attributes (e.g., with(['country' => 'US'])) or model associations. Tradeoff: Limited to Laravel/PHP, but avoids vendor lock-in with MIT license. Recommended for MVP analytics or lightweight observability."*
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4