Download the PHP package brick/date-time without Composer

On this page you can find all versions of the php package brick/date-time. 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 date-time

Brick\DateTime

A powerful set of immutable classes to work with dates and times.

Build Status Coverage Status Latest Stable Version Total Downloads License

Introduction

This library builds an extensive API on top of the native PHP date-time classes, and adds missing concepts such as LocalDate, LocalTime, YearMonth, MonthDay, etc.

The classes follow the ISO 8601 standard for representing date and time concepts.

This component follows an important part of the JSR 310 (Date and Time API) specification from Java. Don't expect an exact match of class and method names though, as a number of differences exist for technical or practical reasons.

All the classes are immutable, they can be safely passed around without being affected.

Installation

This library is installable via Composer:

Requirements

This library requires PHP 8.1 or later.

Project status & release process

While this library is still under development, it is well tested and should be stable enough to use in production environments.

The current releases are numbered 0.x.y. When a non-breaking change is introduced (adding new methods, optimizing existing code, etc.), y is incremented.

When a breaking change is introduced, a new 0.x version cycle is always started.

It is therefore safe to lock your project to a given release cycle, such as 0.6.*.

If you need to upgrade to a newer release cycle, check the release history for a list of changes introduced by each further 0.x.0 version.

Overview

Main classes

The following classes/enums represent the date-time concepts:

These classes belong to the Brick\DateTime namespace.

Clocks

All objects read the current time from a Clock implementation. The following implementations are available:

These classes belong to the Brick\DateTime\Clock namespace.

In your application, you will most likely never touch the defaults, and always use the default clock:

In your tests however, you might need to set the current time to test your application in known conditions. To do this, you can either explicitly pass a Clock instance to now() methods:

Or you can change the default clock for all date-time classes. All methods such as now(), unless provided with an explicit Clock, will use the default clock you provide:

There are also useful shortcut methods to use clocks in your tests, inspired by timecop:

Freeze the time to a specific point

Travel to a specific point in time

Make time move at a given pace

As you can see, you can even combine travel() and scale() methods.

Be very careful to reset() the DefaultClock after each of your tests! If you're using PHPUnit, a good place to do this is in the tearDown() method.

Exceptions

The following exceptions can be thrown:

Doctrine mappings

You can use brick/date-time types in your Doctrine entities using the brick/date-time-doctrine package.

Contributing

Before submitting a pull request, you can check the code using the following tools. Your CI build will fail if any of the following tools reports any issue.

First of all, install dependencies:

Unit tests

Run PHPUnit tests:

Static analysis

Run Psalm static analysis:

Coding Style

Install Easy Coding Standard in its own folder:

Run coding style analysis checks:

Or fix issues found directly:

Rector automated refactoring

Install Rector in its own folder:

Run automated refactoring:


All versions of date-time with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 brick/date-time contains the following files

Loading the files please wait ....