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

Doctrine Dateinterval Laravel Package

herrera-io/doctrine-dateinterval

Adds DateInterval support to Doctrine DBAL and ORM. Provides a custom DBAL type (dateinterval) plus a DATE_INTERVAL DQL function so you can map and query PHP DateInterval values in entities and database fields.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Time-based scheduling systems: Enable storage and querying of recurring events (e.g., subscriptions, billing cycles, or maintenance schedules) with precise interval logic (e.g., "P1Y2M" for yearly + 2 months).
  • Date arithmetic in queries: Replace manual PHP calculations (e.g., start_date + interval) with declarative DQL functions like DATE_INTERVAL('P1Y'), improving query readability and maintainability.
  • Legacy system modernization: Migrate from custom interval storage (e.g., strings or integers) to a typed, queryable DateInterval field in Doctrine entities.
  • Roadmap prioritization: Justify investment in Doctrine-based systems by reducing technical debt for date/time handling (e.g., avoid reinventing interval storage/parsing).
  • Build vs. buy: Opt for this package over custom solutions if the team lacks time/resources to build robust interval type handling for Doctrine.

When to Consider This Package

  • Use this if:
    • Your application heavily relies on Doctrine DBAL/ORM for data persistence.
    • You need to store/retrieve recurring intervals (e.g., subscriptions, cron jobs) with native type safety.
    • Your queries involve date arithmetic (e.g., filtering records based on time durations like "events lasting < 1 year").
    • You’re using Symfony or a custom Doctrine setup and want minimal configuration overhead.
  • Look elsewhere if:
    • You’re not using Doctrine: This package is DBAL/ORM-specific; alternatives like native PHP DateInterval or a NoSQL database may suffice.
    • Your intervals are static or simple: Hardcoded values or integer-based storage (e.g., "seconds since epoch") might be overkill.
    • You need active maintenance: The package is archived (last updated in 2016); evaluate risks for long-term projects.
    • Your team prefers modern PHP: Requires PHP ≥5.3.3 and Doctrine ≤2.x; newer projects may use Doctrine 3+ or alternative tools like DateTimeImmutable.

How to Pitch It (Stakeholders)

For Executives: "This package lets us store and query time intervals (e.g., 'every 6 months') directly in our database using Doctrine, reducing bugs from manual date calculations. For example, we could filter subscriptions expiring in <1 year with a simple query like WHERE expiry_date > DATE_INTERVAL('P1Y'). It’s a lightweight, MIT-licensed solution that integrates seamlessly with our existing Doctrine setup, saving dev time and improving data integrity for time-sensitive features like billing or scheduling."

For Engineers: *"This adds a dateinterval Doctrine type and a DATE_INTERVAL DQL function, enabling native storage/querying of DateInterval objects. Key benefits:

  • Type safety: Store intervals as proper objects (e.g., P1Y2M) instead of strings/integers.
  • Query flexibility: Use DQL for interval comparisons (e.g., WHERE duration < DATE_INTERVAL('P2Y')).
  • Symfony-friendly: Minimal config via YAML or PHP. Tradeoff: Archived but stable; ensure compatibility with your Doctrine version (2.x)."*
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity