Download the PHP package prokki/ext-datetime without Composer

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

Ext-DateTime

Packagist PHP v7.3 codecov Build Status

Extends the native datetime objects (\DateTime and \DateTimeImmutable) with a lot of additional helpful methods.

Most of the new methods are short cuts of already existing functionality. But these methods will help you to save time and code if you need to handle a many date- and time-operations.

All new methods support method chaining.

Table of Contents

Requirements

The usage of PHP v7.3 is obligatory.

Integration

Please install via composer.

Usage

The classes and instances of the classes ExtDateTime/DateTimeImmutable can be used exactly like native datetime objects/classes.

Example

Static Initialization

Similar to the native objects there are several others ways to create a datetime object.

All static methods can be used to implement method chaining.

create()

Use the static constructor create() to use chaining immediately.

current()

The static constructor current() returns a datetime object with the current date/time. But in opposite to DateTime::create("now") this method returns the object with additional microtime.

createFromObject()

Creates a new object from any datetime object implementing the DateTimeInterface.

Cloning

Two new methods add the availability to use chaining directly after cloning an object.

duplicate()

This method is just a wrapper function for clone:

toImmutable() / toMutable()

Instead of using static constructors (DateTime::createFromImmutable or DateTimeImmutable::createFromMutable) you can also use these new non-static methods.

Manipulating

Most of the new methods are short cuts to avoid re-initialization of necessary parameter in your code.

addHours() / subHours()

Adds or subtracts hours of a datetime object.

addDays() / subHours()

Adds or subtracts days of a datetime object.

addMonth() / subMonth()

Adds or subtracts months of a datetime object.

Attention: This methods behaves differently than the suspected background function of adding days. If the current date is the last day of the month (31/30/29/28) and the target month has less days then the current month, the day will be set to the last day of the target month.

Example: The datetime object is

2017-01-30 17:00:00

and you want to add 1 month, the result will be

2017-02-28 17:00:00

Instant Setter Methods

toEndOfDay()

Sets the time to the end of the day (23:59:59).

toNoon()

Sets the time to noon (12:00:00).

toStartOfDay()

Sets the time to the start of the day (00:00:00).

toStartOfMonth()

Sets the date to the first day of the month and additionally the time to the start of the day (00:00:00).

toEndOfMonth()

Sets the date to the last day of the month and additionally the time to the end of the day (23:59:59).


All versions of ext-datetime with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3.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 prokki/ext-datetime contains the following files

Loading the files please wait ....