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
Php Date Bundle

Php Date Bundle Laravel Package

assoconnect/php-date-bundle

View on GitHub
Deep Wiki
Context7

Symfony bundle for assoconnect/php-date library

Frequently asked questions about Php Date Bundle
What is assoconnect/php-date-bundle used for?
It provides date-related Symfony features built on the AbsoluteDate abstraction from assoconnect/php-date. The bundle includes Doctrine types for AbsoluteDate and DateTimeZone, an AbsoluteDateNormalizer, translatable date support, a Twig date filter, and an AbsoluteDateClock based on the current Clock. It is intended for Symfony projects that want time-agnostic domain dates and consistent serialization or formatting.
Does assoconnect/php-date-bundle support Laravel?
Not natively. The bundle is Symfony-centric and relies on Symfony components such as Clock and Serializer plus Doctrine and Twig integrations. Laravel projects would need manual service wiring and adapters, and there is no Laravel service provider, config publisher, Eloquent casting, Blade directive, or Laravel validation rule in the package. Treat Laravel support as a custom integration rather than a supported feature.
How do I install assoconnect/php-date-bundle?
Install it with Composer using composer require assoconnect/php-date-bundle. In a Symfony application, register the bundle according to your Symfony version and configure the Doctrine types, normalizer, Twig extension, or clock services you need. In Laravel, you can install the Composer package but must wire services and adapters manually.
Do I need Symfony to use assoconnect/php-date-bundle?
The package is designed as a Symfony bundle and depends on Symfony ecosystem components, Doctrine types, and Twig. You can technically install it in a non-Symfony PHP project, but you would need to provide the expected services and integrations yourself. For Laravel, that means significant manual bridging, especially around Clock, Serializer, Doctrine, and Twig.
How does AbsoluteDate differ from Carbon in Laravel?
AbsoluteDate is a time-agnostic abstraction intended to represent a date independently of the system clock, while Laravel's Carbon is a mutable date-time library tightly integrated with Laravel's Time facade. AbsoluteDate can be useful for domain events, audit timestamps, or time-travel testing where processing time should be explicit. In Laravel, Carbon is already the default for created_at, updated_at, scheduling, and most framework date handling, so mixing both requires clear boundaries.
Can I use AbsoluteDate with Eloquent models?
The bundle does not provide Eloquent model casting, accessors, or mutators for AbsoluteDate. You would need custom casts or accessor methods that convert between AbsoluteDate and database values or Carbon instances. If you only need standard timestamp handling, Laravel's built-in date casts and Carbon are simpler.
How do I configure Doctrine types for AbsoluteDate?
Register AbsoluteDateType and DateTimeZoneType with Doctrine DBAL or ORM so Doctrine can map database values to AbsoluteDate and DateTimeZone objects. The exact registration depends on whether you use Doctrine DBAL directly, Doctrine ORM, or Symfony Doctrine bundle configuration. In Laravel, this only applies if you are using Doctrine rather than Eloquent.
Does this package provide Blade directives or only Twig?
It provides a Twig filter through AbsoluteDateExtension, demonstrated as {{ myAbsoluteDate|date }}. There is no Blade directive support in the package. Laravel applications using Blade would need a custom directive or presenter to format AbsoluteDate values.
How do I test time-dependent code with AbsoluteDateClock?
AbsoluteDateClock creates AbsoluteDate values based on the current Clock, which lets you inject or mock the clock in time-sensitive domain logic. That can support deterministic tests for event timestamps or business dates without relying on the real system time. In Laravel, however, the Time facade and Carbon travel helpers already cover many time-mocking scenarios, so evaluate whether the extra abstraction is worth it.
What are alternatives to assoconnect/php-date-bundle for Laravel?
For most Laravel applications, nesbot/carbon with Laravel's Time facade covers date manipulation, testing, and timestamp handling. If you need activity or audit timestamps, packages such as spatie/laravel-activitylog may be more direct. For immutable domain dates, you could use Carbon's immutable dates or a dedicated value-object package and build Laravel-native casts and validation around it.
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.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log