Download the PHP package salavert/time-ago-in-words without Composer

On this page you can find all versions of the php package salavert/time-ago-in-words. 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-ago-in-words

Time ago in words Twig extension

[Packagist]() Build Status

This is a Twig extension for Symfony Framework where you can easily convert a datetime/timestamp to a distance of time in words.

By example

Outputs 3 days ago

Installation for Symfony

1) Update your composer.json

2) Register an Extension as a Service

Now you must let the Service Container know about your newly created Twig Extension:

YAML:

XML:

Usage

To display distance of time in words between a date and current date:

{{ message.created | time_ago_in_words }}

To display distance of time between two custom dates you should use

{{ message.created | distance_of_time_in_words(message.updated) }}

You also have two available options, for both time_ago_in_words & distance_of_time_in_words filters

Thus, if you want to have the months approximation but not the seconds one, you should use:

{{ message.created | time_ago_in_words(false, true) }}

Translations

Add the following translations to your

This is a translation to spanish:

# Time ago in words - Twig Extension
less than %seconds seconds ago: hace menos de %seconds segundos
half a minute ago: hace medio minuto
less than a minute ago: hace menos de un minuto
1 minute ago: hace 1 minuto
%minutes minutes ago: hace %minutes minutos
about 1 hour ago: hace casi 1 hora
about %hours hours ago: hace %hours horas
1 day ago: hace 1 día
%days days ago: hace %days días
"{1} 1 month ago |]1,Inf[ %months months ago": "{1} hace un mes |]1,Inf[ hace %months meses"
"{1} 1 year ago |]1,Inf[ %years years ago":  "hace un año |]1,Inf[ Hace %years años"

In the same case, for future:

# Time ago in words - Twig Extension
in less than %seconds seconds: en menos de %seconds segundos
in half a minute: en medio minuto
in less than a minute: en menos de un minuto
in 1 minute: en 1 minuto
in %minutes minutes: en %minutes minutos
in about 1 hour: dentro de casi 1 hora
in about %hours hours: en %hours horas
in 1 day: en 1 día
in %days days: en %days días

Testing

To launch all tests first make sure dependecies are met with composer and run:

./vendor/phpunit/phpunit/phpunit

All versions of time-ago-in-words with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
twig/twig Version ~1.12 || ~2
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 salavert/time-ago-in-words contains the following files

Loading the files please wait ....