PHP code example of railt / carbon-extension

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

    

railt / carbon-extension example snippets


$app = new Railt\Foundation\Application();

$app->extend(Railt\CarbonExtension\Extension::class); // Here

'extensions' => [
    // ...
    \Railt\CarbonExtension\Extension::class, // Here
]

public function resolver(): array
{
    return [
        'id'        => 42,
        'some'      => 'Example',
        'createdAt' => '2018-04-28T17:55:27+00:00', // Yesterday
    ];
}

// Resolver
// Note: "$arg" argument definition similar with "$input->get('arg')"
public function handle(\DateTimeInterface $arg)
{
    return $arg->format(\DateTime::RFC3339);
}