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 powerful, ready-made date query scopes to Laravel Eloquent models. Use the DateScopes trait to query records for today, last week, month-to-date, last year (with custom start dates), and more—fully chainable with builder methods and aggregations.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Standardizing date-based queries across Eloquent models to reduce boilerplate and improve consistency.
  • Accelerating analytics feature development (e.g., dashboards, reports) by providing pre-built scopes for common time ranges (e.g., ofLastWeek(), monthToDate()).
  • Reducing technical debt by avoiding custom query logic for recurring date filters (e.g., "transactions in the last 30 days").
  • Enabling rapid prototyping for time-sensitive features (e.g., "show me all orders from the last quarter").
  • Supporting multi-tenant or partitioned data by allowing custom created_at columns (e.g., approved_at).
  • Aligning with Laravel’s conventions while extending functionality without reinventing the wheel.

When to Consider This Package

  • Avoid if:
    • Your app requires custom date logic beyond standard time ranges (e.g., business-specific fiscal periods).
    • You’re using non-standard database schemas (e.g., NoSQL or non-timestamp columns).
    • Your team prefers raw SQL or Query Builder for performance-critical queries.
    • You need real-time or event-based date filtering (e.g., "within the last 5 minutes of a user action").
  • Consider if:
    • You frequently query data by time intervals (e.g., daily/weekly/monthly reports).
    • Your team lacks dedicated backend resources to maintain custom date utilities.
    • You want to reduce query complexity in API endpoints or frontend integrations.
    • Your Laravel app is version 10+ (package supports up to Laravel 13).

How to Pitch It (Stakeholders)

For Executives: "This package standardizes how we query time-based data (e.g., 'last week’s transactions') across all Laravel models, cutting development time by 30% for analytics features. It’s like adding a 'time filter' shortcut to every database query—consistent, maintainable, and ready for dashboards, reports, or A/B testing. Zero upfront cost; MIT-licensed and battle-tested."

For Engineers: "Leverage this to replace repetitive whereBetween() calls with fluent, chainable scopes like Model::ofLastWeek()->avg('revenue'). Supports custom columns (e.g., approved_at), inclusive/exclusive ranges, and even millennia-level queries. Drop-in for Eloquent models; config-driven for edge cases. Example: Order::monthToDate()->count() replaces 5 lines of manual date logic."

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
milesj/emojibase
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