Download the PHP package mpratt/relativetime without Composer

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

RelativeTime

Build Status Total Downloads Monthly Downloads Latest Stable Version

Support via PayPal

RelativeTime is a lightweight and easy to use library that helps you calculate the time difference between two dates and returns the result in words (like, 5 minutes ago or 5 minutes left). The library supports other languages as well like Spanish, PortugueseBR, French, Czech, Russian, SimplifiedChinese, Swedish and German

It uses the standard \DateTime() and \DateInterval() classes found in modern PHP versions. For more information, please read the Usage section of this README.

Requirements

Installation

Install with Composer

If you're using Composer to manage dependencies, you can use this library by creating a composer.json file and adding this:

{
    "require": {
        "mpratt/relativetime": "~1.0"
    }
}

Save it and run composer.phar install

Standalone Installation (without Composer)

Download the latest release or clone this repository, place the Lib/RelativeTime directory somewhere in your project. Afterwards, you only need to include the included Autoload.php file.

Or if you already have PSR-0 compliant autoloader, you just need to register RelativeTime:

Usage

Most of the times you are going to need the convert($fromDate, $toDate) method.

There are 2 other useful methods timeAgo($date) and timeLeft($date), that calculate the time since/until the current date/time.

Configuration Options

The main object accepts an array with configuration directives

Directive Definition
language The language to be used, for example English, Spanish, PortugueseBR, French, Czech, Russian, SimplifiedChinese, Swedish or German are supported. Even The instantiated object is allowed, as in new \RelativeTime\Languages\English()
separator The separator between time units. , by default.
truncate The number of units you want to display. By default it displays all of the available ones.
suffix Whether or not to append the .... ago or ..... left
use_weeks By default is set to false. When set to true it will include week numbers too.

Author

Michael Pratt - http://www.michael-pratt.com See also the list of contributors which participated in this project.

If you like this library, it has been useful to you and want to support me, you can do it via paypal.

Support via PayPal

License

RelativeTime is licensed under the MIT License - see the LICENSE file for details


All versions of relativetime with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
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 mpratt/relativetime contains the following files

Loading the files please wait ....