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

Date Bundle Laravel Package

mrgoodbytes8667/date-bundle

mrgoodbytes8667/date-bundle is a PHP package that bundles date-related functionality for Laravel/PHP projects. It provides a Composer-installable date bundle for keeping date handling in a dedicated package rather than scattered across application code.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install and inspect before adopting.

    composer require mrgoodbytes8667/date-bundle
    

    With Symfony Flex the bundle should be auto-registered; otherwise add it to config/bundles.php:

    return [
        // ...
        MrGoodbytes8667\DateBundle\DateBundle::class => ['all' => true],
    ];
    
  2. Look in this order:

    • README.md in the repo for the intended public API and any Twig/DI examples.
    • src/ for the service classes and any DependencyInjection/ extension that exposes configuration (config/packages/date_bundle.yaml).
    • src/Twig/ if you need date formatting in templates.
    • composer.json for the supported PHP/Symfony version range before committing to it.
    • tests/ (if present) — the fastest way to learn expected behavior.
  3. First use case — a formatting/relative-date helper. The common pattern for a "date bundle" is a service you inject where you currently call new \DateTime() or format():

    public function __construct(private DateService $dates) {}
    

    and/or a Twig filter used as {{ someDate|date_human }}. Confirm the exact names from source — with 0 stars and no declared license, do not assume the API is stable or documented.

Implementation Patterns

  • Inject, don't instantiate. Treat the bundle's services like any other Symfony service: constructor-inject and let the container manage timezone/config. This keeps date logic testable and consistent across controllers, commands, and listeners.
  • Centralize formatting. Use the bundle's formatter/filter in Twig and services so user-facing dates share one format. If the bundle lacks a needed format, wrap it in your own small service rather than sprinkling ->format('Y-m-d') across the codebase.
  • Use ranges/intervals for query building. If the bundle exposes date-range objects (start/end, iteration), use them to build Doctrine BETWEEN clauses and to avoid off-by-one bugs when iterating days/weeks.
  • Respect the configured timezone. Store UTC, render in the user's timezone. If the bundle has a timezone config key, set it globally in date_bundle.yaml rather than passing timezones ad hoc.
  • Testing: freeze the clock where possible (e.g., Symfony's ClockMock or Carbon's setTestNow if the bundle relies on it) so relative-date output is deterministic. Add a thin adapter over the bundle's service so your tests don't depend on an unmaintained library's internals.
  • Integration points: the bundle typically slots into Twig (filters/functions), formatters in API responses (serializer normalizers), and console commands. Wire it wherever you currently duplicate date logic.

Gotchas and Tips

  • License is NOASSERTION. Treat this as unresolved for compliance. Before shipping commercially, confirm the actual license in the repo — a missing/ambiguous license can block legal review.
  • Zero stars / low adoption. Expect limited documentation, few Stack Overflow answers, and potential API changes. Pin the version in composer.json and read the diff before upgrading (last release 2025-01-16).
  • Symfony/PHP constraints. Verify composer.json requirements against your app. A small bundle may not yet support the latest Symfony/PHP versions; a failed composer require is usually a constraint mismatch.
  • Bundle registration. If Flex doesn't register it, dates services simply won't exist and you'll get "cannot autowire" errors. Check config/bundles.php and run bin/console debug:container <service> to confirm services are wired.
  • Timezone defaults. PHP's default timezone and the bundle's may differ. Set date.timezone in php.ini or the bundle config and confirm with a quick dump($service->now()) rather than guessing.
  • Fall back gracefully. If the bundle is only wrapping \DateTimeImmutable/Carbon, consider using those directly. Adopting a thin, lightly maintained bundle adds a dependency and an upgrade risk for marginal benefit — measure whether it truly saves code.
  • Extension points. If the bundle exposes interfaces for formatters or clock providers, implement them in your app instead of forking. That gives you control without diverging from upstream.
  • Debugging tips: use debug:container --tag=twig.extension to find its Twig extension, and debug:config date_bundle (if a config tree exists) to see available options. If behavior is surprising, read the source — at this size, the entire bundle is likely a short read.
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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource