PHP code example of papimod / date

1. Go to this page and download the library: Download papimod/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/ */

    

papimod / date example snippets




use Papi\PapiBuilder;
use Papimod\Dotenv\DotEnvModule;
use Papimod\Date\DateModule;
use function DI\create;

$builder = new PapiBuilder();

$builder->setModule(
        DotEnvModule::class,
        DateModule::class
    )
    ->build()
    ->run();

final class MyService
{
    public function __construct(public readonly DateService $date_service) 
    {
    }

    public getNow(): string
    {
        $now = new DateTime();
        return $this->date_service->format($now);
    }
}