mathiasverraes / kildoc

Declarative interfaces > documentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kildoc

Status

This is very much proof of concept code, and I don't intend to actually build this. So if you want to use this, expect to contribute all the work yourself.

Goal

I always have to google which characters to use when doing date formats

<?php
echo $date->format("Y-m-d\TH:i:sO");

So what if I didn't have to?

<?php
$format = (new DateFormat)
        ->year()->dash()->month()->dash()->day()
        ->raw("\T")
        ->hours()->colon()->minutes()->colon()->seconds()
        ->diffToUTCInHours();

echo $format($date); // 2019-02-07T10:25:55+0100
);

There are some more examples in the tests.

You could do all kinds of fun stuff like $format->->month()->long()->space()->quote()->year()->twoDigits() to get January '19, but that hasn't been implemented.

About

Declarative interfaces > documentation


Languages

Language:PHP 100.0%