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

Laravel Date Scopes Laravel Package

laracraft-tech/laravel-date-scopes

Add a DateScopes trait to Eloquent models to query records by common date ranges: today, last week, month-to-date, last year (with custom start), and more. Chain scopes with aggregates like sum/avg for fast stats-friendly queries.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Time-based analytics & reporting: Enables rapid development of dashboards, KPIs, or financial reports (e.g., "revenue last 7 days") without custom query logic.
  • Reduced technical debt: Replaces repetitive whereBetween() queries across models (e.g., created_at BETWEEN ...) with reusable, consistent scopes.
  • Build vs. buy: Justifies not building custom date utilities when this package offers 90%+ coverage of common use cases (e.g., "transactions this month").
  • API/Backend roadmap: Critical for time-sensitive endpoints (e.g., "user activity in the last 24 hours") or compliance reporting (e.g., "audit logs from 2023").
  • Multi-tenant SaaS: Simplifies tenant-specific time-range queries (e.g., "tenant X’s orders in Q1 2024").

When to Consider This Package

  • Avoid if:
    • Your app uses non-standard date columns (e.g., event_timestamp instead of created_at) and requires custom logic (e.g., timezone offsets).
    • You need sub-second precision (e.g., millisecond-level queries) beyond what the package supports.
    • Your team prefers raw SQL or query builders over Eloquent traits for maintainability.
    • You’re already using a dedicated analytics tool (e.g., Laravel Scout, PostgreSQL’s date_trunc) that handles time ranges natively.
  • Look elsewhere if:
    • You require recurring intervals (e.g., "every Monday at 9 AM")—this package focuses on fixed lookbacks.
    • Your database is NoSQL (e.g., MongoDB) or lacks timestamp columns.
    • You need fuzzy time ranges (e.g., "transactions from 3 days before the user’s last login").

How to Pitch It (Stakeholders)

For Executives:

*"This package cuts development time for time-based queries by 80%. For example, instead of writing custom SQL to fetch ‘last month’s orders’ (a task that takes 1–2 hours per endpoint), our team can use Order::ofLastMonth()—a single line of code. This directly impacts:

  • Speed to market: Faster iteration on analytics/dashboards.
  • Cost savings: No need to hire senior devs to build/review repetitive date logic.
  • Scalability: Handles edge cases (e.g., inclusive/exclusive ranges) consistently across the codebase. It’s a $0 investment with immediate ROI for any feature requiring ‘recent,’ ‘this week,’ or ‘year-to-date’ data."

For Engineers:

*"This is a batteries-included solution for Eloquent date queries. Key benefits:

  • 90+ scopes (seconds to millennia) out of the box—no more copying/pasting Carbon logic.
  • Configurable inclusivity: Toggle whether ‘last week’ includes today via a single setting or per-query.
  • Zero performance overhead: Uses native SQL BETWEEN clauses under the hood.
  • Future-proof: Actively maintained (last release: 2026), with Laravel 13 support. Use case: Add the DateScopes trait to any model, then chain scopes like User::ofLast7Days()->count() or Invoice::monthToDate()->sum('amount').* Tradeoff: Minimal learning curve if you’re already using Eloquent, but requires adopting a trait-based pattern."*
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai