Download the PHP package andanteproject/timestampable-bundle without Composer

On this page you can find all versions of the php package andanteproject/timestampable-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package timestampable-bundle

Andante Project Logo

Timestampable Bundle

Symfony Bundle - Andante Project

Latest Version Github actions Framework Php8 PhpStan

A Symfony Bundle to handle entity createdAt and updatedAt dates with Doctrine. 🕰

Requirements

Symfony 5.x–8.x and PHP 8.2.

Install

Via Composer:

Features

Basic usage

After install, ensure the bundle is registered in your Symfony bundles list (config/bundles.php):

This is done automatically if you use Symfony Flex. Otherwise, register it manually.

Suppose you have an App\Entity\Article Doctrine entity and want to track created and updated dates. Implement Andante\TimestampableBundle\Timestampable\TimestampableInterface and use the Andante\TimestampableBundle\Timestampable\TimestampableTrait trait.

Update your database schema using your usual Doctrine workflow (e.g. bin/console doctrine:schema:update --force, or use migrations for a safer approach).

You should see new columns named created_at and updated_at (Doctrine naming strategy.

You're done! 🎉

TimestampableInterface and TimestampableTrait are shortcuts that combine CreatedAtTimestampableInterface + CreatedAtTimestampableTrait and UpdatedAtTimestampableInterface + UpdatedAtTimestampableTrait. To track only created or updated dates, use the more specific interfaces and traits below.

To track Implement Use trait
Created date only Andante\TimestampableBundle\Timestampable\CreatedAtTimestampableInterface Andante\TimestampableBundle\Timestampable\CreatedAtTimestampableTrait
Updated date only Andante\TimestampableBundle\Timestampable\UpdatedAtTimestampableInterface Andante\TimestampableBundle\Timestampable\UpdatedAtTimestampableTrait
Both Andante\TimestampableBundle\Timestampable\TimestampableInterface Andante\TimestampableBundle\Timestampable\TimestampableTrait

Usage without the trait

This lets you use different property names (e.g. created and updated instead of createdAt and updatedAt). You must specify these in the bundle configuration.

Metadata cache warming

The bundle discovers which entities are timestampable and how their createdAt / updatedAt properties and columns are configured. That information is metadata: it is computed once and then cached in a PHP file under your cache directory so later requests can reuse it without scanning entities again.

By default, metadata is built on first use: the first time a timestampable entity is persisted or updated in a request, the bundle builds metadata for all mapped entities, caches it in memory and writes it to disk. Subsequent requests (and the same request) then use the cached metadata. For most applications this is enough and you do not need to change anything.

If you want to avoid any metadata computation on the first request (e.g. in production after a deploy, or in CI when running a single command), you can enable cache warming. When enabled, a Symfony cache warmer runs during cache:warmup (and when the cache is built on the first request in dev). It precomputes timestampable metadata for all known Doctrine entities and writes it to the cache file. After that, the first real request already uses the prebuilt metadata.

When to enable it

You can turn it on in the configuration with metadata_cache_warmer_enabled: true.

Configuration (completely optional)

This bundle is built to save you time and follow best practices out of the box.

You do not need an andante_timestampable.yaml config file in your application.

If you need to customize it (e.g. for legacy code), you can change most behavior via the bundle configuration:

Metadata cache warmer

See Metadata cache warming for a full explanation. Summary:

Option Default Description
metadata_cache_warmer_enabled false Set to true to precompute timestampable metadata during cache warmup (e.g. cache:warmup). Metadata is written to %kernel.cache_dir%/timestampable_metadata.php.

Built with ❤️ by the Andante Project team.


All versions of timestampable-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
symfony/framework-bundle Version ^5.0 | ^6.0 | ^7.0 | ^8.0
doctrine/common Version ^2.13 || ^3.0
doctrine/doctrine-bundle Version ^2.10 || ^3.0
doctrine/event-manager Version ^1.2 | ^2.0
doctrine/orm Version ^2.15.3 || ^3.0
symfony/clock Version ^6.2 | ^7.0 | ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package andanteproject/timestampable-bundle contains the following files

Loading the files please wait ...