1. Go to this page and download the library: Download cocur/human-date library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Cocur\HumanDate\Bridge\Symfony\Translation\SymfonyTranslation;
use Cocur\HumanDate\HumanDate;
// Get or create an instance of Symfony\Component\Translation\TranslatorInterface
// For example, inside a controller
$sfTrans = $this->get('translation');
// Create an adapter with translation domain "human_date" and locale "en"
// trans() passes domain and locale to every call of Symfony\Component\Translation\TranslatorInterface::trans()
// If you omit the domain and locale it uses the defaults.
$trans = new SymfonyTranslation($sfTrans, 'human_date', 'en');
$humanDate = new HumanDate($trans);
use Cocur\HumanDate\Bridge\Twig\HumanDateExtension;
use Cocur\HumanDate\HumanDate;
$twig = new Twig_Environment($loader);
$twig->addExtension(new HumanDateExtension(new HumanDate()));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.