Download the PHP package org_heigl/dateintervalcomparator without Composer

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

DateIntervalComparator

Compare two DateInterval-Objects with one another.

Build Status Code Climate Coverage Status Scrutinizer Code Quality

Total Downloads Latest Stable Version License

Installation

DateIntervalComparator is best installed using composer

composer require org_heigl/dateintervalcomparator

Usage

The uses the same return values all comparison-functions in PHP use. When the first value is smaller than the second it returns -1, if the first is greater than the second it returns 1 and when both are equals it returns 0. The method can therefore be used as callback to sort arrays.

This library assumes that the compared intervals are sensible and alike. Comparing 3 months and 4 days against 5 months and 7 days is what this library is made for. It's not been made for comparing 3 months and 4 days against 94 days. Due to the different number of days in a month this comparison will be different depending on the start-date and we do want to compare only the Intervals and not the resulting end-dates!

As long as the values do not exceed their moduli (e.g. a value of 13 for month or 25 for the hour) you are on the safe side.

You can even enforce this safe side by setting . That will then throw an exception when one of the values for month, day, hour, minute or second will exceed the values 12, 31, 24, 60 and 60 resp.

Caveat/Limitations

Take care! DateIntervals can be nasty!

Due to their nature DateIntervals do not take Date or Time into account! So might or might not be the same as ! This Library will compare on a "same entity"-level. So first years are compared, then months, then weeks and so on. When you have an interval that is describing only 55 weeks and compare that to one that is only describing one year, the one year will be considered greater even though 55 weeks are more. So you should only compare comparable intervals!

The same can happen with f.e. and You'd think they are the same, but consider DaylightSavingsTime and they suddenly might not be the same! So currently the would be considered the "higher" one.

License

This library is published under the MIT-License. Find a copy in the LICENSE.md-File.


All versions of dateintervalcomparator with dependencies

PHP Build Version
Package Version
Requires php Version ^7.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 org_heigl/dateintervalcomparator contains the following files

Loading the files please wait ....