Download the PHP package timostamm/doctrine-fixed-timezone without Composer

On this page you can find all versions of the php package timostamm/doctrine-fixed-timezone. 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 doctrine-fixed-timezone

Fixed timezone types for Doctrine

The problem

If your application handles dates with different timezones, you have two options:

1) save the time zone of each date to the database

If you need to know the timezone later on, this is the only option.

Unfortunately, this makes queries on dates practically impossible: SELECT * FROM x WHERE x.date > CURRENT_TIMESTAMP() will lead to unexpected results. CURRENT_TIMESTAMP will use the current time of the database server, and your dates are interpreted in the wrong timezone.

2) Convert all dates saved in the database to one timezone

If you convert all dates to the timezone of the database server, your queries will work as expected.

Unfortunately, Doctrine does not come with an option to do this conversion.

Solution provided by this library

This library provides replacements for the DBAL types datetime, and datetime_immutable, which will automatically convert dates into the database timezone.

When reading a datetime or datetime_immutable, the timezone will not be converted to the PHP timezone. The dates will refer to the correct point in time, but have the database timezone.

Regarding standalone date and time

A date without a time, or a time without a date both do not refer to an absolute point in time. Since PHP does not have types to represent stand-alone times or dates, developers use DateTime objects to represent those too, but their timezone should be ignored.

Therefore, it should be fine to use the standard date and time doctrine types.

How to use

Symfony:

To set the database timezone, define a constant define('DATABASE_TIMEZONE', 'Europe/Berline'); or set an environment variable DATABASE_TIMEZONE.

Otherwise, the PHP timezone is used.

Background

https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/cookbook/working-with-datetime.html#handling-different-timezones-with-the-datetime-type


All versions of doctrine-fixed-timezone with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8.0
doctrine/dbal Version ^2.7
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 timostamm/doctrine-fixed-timezone contains the following files

Loading the files please wait ....