Download the PHP package stevegrunwell/time-constants without Composer

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

Time Constants

Unit Tests Packagist

The Time Constants package defines a number of useful PHP constants within your application, making it easier to express measures of time.

For example, assume we have a cache() function that accepts three arguments:

  1. The cache key.
  2. The value to cache.
  3. The amount of time (in seconds) to cache the value.

Currently, caching a value for 24 hours might look something like this:

Instead of spending the time figuring out what 24 * 60 * 60 means (or the fact that 86400 is meant to be one day in seconds), Time Constants allows you to represent the time using an easy-to-understand PHP constant:

If the requirements changed and we needed to cache the value for multiple days, we can rewrite it as:

These constants may seem familiar to WordPress developers, as they're absolutely inspired by WordPress' use of time constants. This package goes a bit further, however, adding *_IN_MINUTES constants, for easier use with libraries like Laravel's Cache facade.

Installation

Time Constants is intended to be installed via Composer:

The package has been configured to automatically expose the constants.php file via the Composer-generated autoloader, so you'll be ready to use the constants as soon as the package has been installed!

Defined constants

This is a list of all constants defined by this package, along with their values. Each constant is wrapped in a if (! defined(...)) conditional, ensuring these constants can easily be redefined if necessary and won't conflict with existing constants.

As of version 2.0.0 of this library, all of these constants are defined in the TimeConstants namespace. If you are upgrading from version 1.x, please see the 2.0.0 release notes for notes about migration.

Please note that these constants are defined for convenience, and not necessarily for accuracy; all months are treated as 30 days, and years as 365 days. If you need support for leap years or more advanced measures of time, you might consider PHP's DateTime class or Nesbot's Carbon package.

Time based in seconds

Time based in minutes

Multipliers

These can be helpful when dealing with fractions of a second. For example, all of the following are equivalent:


All versions of time-constants with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0 | ^8.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 stevegrunwell/time-constants contains the following files

Loading the files please wait ....