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
Timestampable Bundle

Timestampable Bundle Laravel Package

andanteproject/timestampable-bundle

Symfony bundle for Doctrine entities that automatically manages createdAt and updatedAt with DateTimeImmutable. Zero config to start, customizable, uses Symfony Clock, no attributes needed, and won’t overwrite timestamps you set manually. Compatible with Symfony 5–8, PHP 8.2.

View on GitHub
Deep Wiki
Context7

A Symfony Bundle to handle create and update dates with Doctrine Entities

Frequently asked questions about Timestampable Bundle
Can I use this bundle in a pure Laravel project without Symfony components?
The bundle is Symfony-centric, but you can adapt it for Laravel by wrapping it in a custom service provider to bridge Symfony Clock and Doctrine events. Alternatively, consider Laravel-native alternatives like `spatie/laravel-timestamps` if you don’t need Symfony’s abstractions.
How does this bundle handle manual timestamp overrides in Laravel?
The bundle respects manually set `createdAt` or `updatedAt` values and won’t overwrite them, similar to Laravel’s `HasTimestamps`. This ensures consistency whether you set timestamps programmatically or let the bundle handle them automatically.
What Laravel versions support this bundle via Symfony’s Bridge?
The bundle requires PHP 8.2+, which aligns with Laravel 9.x+. For older Laravel versions (pre-9.x), you’d need to polyfill Symfony Clock or use a Laravel-specific wrapper, as the bundle isn’t officially Laravel-compatible.
Will this bundle conflict with Gedmo\Timestampable or other timestamping solutions?
Yes, conflicts can occur since both bundles hook into Doctrine lifecycle events. Disable one or explicitly configure the bundle to avoid overlaps. Test in a staging environment first to identify conflicts early.
How do I customize column names for `createdAt` and `updatedAt` in Laravel?
Use the bundle’s optional configuration in `config/packages/andante_timestampable.yaml` to define custom column names (e.g., `created_at` instead of `createdAt`). This mirrors Laravel’s `HasTimestamps` customization but via Symfony’s YAML config.
Does this bundle work with Laravel’s Eloquent ORM, or only Doctrine?
This bundle is **Doctrine-only** and won’t work with Eloquent. For Eloquent, use Laravel’s built-in `HasTimestamps` trait or packages like `spatie/laravel-activitylog`. If you’re using API Platform or Doctrine in Laravel, this bundle is a solid alternative.
How does Symfony Clock improve timestamp accuracy in Laravel?
Symfony Clock provides a time abstraction layer, making timestamps predictable and testable (e.g., freezing time in unit tests). In Laravel, this translates to more reliable `createdAt`/`updatedAt` values, especially in distributed systems or serverless environments.
Should I enable `metadata_cache_warmer_enabled` in production for Laravel?
Only enable this if you’re experiencing cold-start performance issues with Doctrine metadata. For most Laravel apps, the default lazy warmup is sufficient. If enabled, test with `php bin/console cache:clear --no-warmup` to avoid deployment surprises.
Can I migrate from Laravel’s `HasTimestamps` to this bundle without downtime?
Yes, adopt it incrementally. Start by adding the trait to new entities, then migrate legacy entities using the bundle’s optional configuration. Use Doctrine migrations to update schema if column names differ (e.g., snake_case vs. camelCase).
What’s the performance impact of this bundle in high-traffic Laravel APIs?
The bundle adds minimal overhead, primarily during entity persistence. Benchmark in staging to compare against manual timestamp handling. For high-throughput APIs, ensure your database indexes `createdAt`/`updatedAt` columns for query performance.
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.
aimeos/prisma
besmartand-pro/php-quality-config
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
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views