Download the PHP package midnight/calendrics without Composer

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

Calendrics

Dates, times, durations, and time zones for PHP, based on the Temporal API.

Calendrics separates a calendar date from a timestamp and makes time zones explicit. Its immutable values, typed options, and named arguments let application code express whether it means “tomorrow at the same local time” or “24 hours later.”

Contributing

Install

You need PHP 8.4 or newer, Composer, and the intl extension. The project tests on 64-bit PHP 8.4 and 8.5; 32-bit PHP is not covered by CI.

The package is currently pre-1.0. Public APIs may change between minor versions; see the compatibility policy before upgrading.

Quickstart

Save this as example.php in a project with the package installed, then run php example.php:

Choose a type

You have… Use Example
A date without a time zone PlainDate A birthday or invoice date
A point on the global timeline Instant An event timestamp
A date and time in a named zone ZonedDateTime A meeting in Europe/Vienna
A local date and time, with no zone yet PlainDateTime A form's local date/time input
A time of day PlainTime A shop's opening time
A year and month PlainYearMonth A billing period
A recurring month and day PlainMonthDay An anniversary
An amount of calendar or elapsed time Duration Two months, or 90 minutes

Now supplies the current instant and current local values. A plain value never acquires a time zone implicitly: choose one when converting it to a zoned value.

Calendar days and elapsed hours

A calendar day is not always 24 hours. Across a daylight-saving transition, choose the operation that matches your intent:

Local times can also be skipped or repeated when clocks change. Pass Disambiguation::Reject when constructing a zoned value if your application should ask the user to resolve that ambiguity. The usage guide shows the options.

Working with values

Use parse() for strings, constructors for explicit values, and fromFields() when you need calendar-specific fields. Operations such as add(), with(), and round() return new values.

Options use enums such as Overflow::Reject, Unit::Month, and RoundingMode::HalfEven. Use compare() or equals() to compare values; PHP's native object comparison operators do not implement Temporal ordering.

The usage guide covers differences and rounding, calendars, localized formatting, JSON, PHP DateTimeInterface conversion, and the public Spec API.

Precision and portability

Calendrics has two public layers: the PHP-oriented Calendrics\ API shown here and the Temporal-shaped Calendrics\Spec\ API. Most applications should start with the first. Neither layer's internal implementation namespace is a public API.

Project status and quality

The project runs PHPUnit, PHPStan, Psalm, and Mago. Its mutation gate covers ten top-level PHP-oriented classes. Temporal conformance is checked with a translated subset of upstream test262; unsupported JavaScript or harness cases are reported as incomplete. Testing scope and development commands explain the checks.

See the GitHub issues for defects and planned work.

License

MIT


All versions of calendrics with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
ext-intl Version *
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 midnight/calendrics contains the following files

Loading the files please wait ...