PHP Memory Lane - Carbon FY

Note: Opinions expressed on this site do not reflect the views of clients, employers, or any organizations affiliated with past or present.

Another Trip Down Memory Lane with carbon-fy

When I went down memory lane with carbon-nbd a few days ago, I realized I had a sibling library waiting for the same treatment: Carbon FY.

carbon-fy is a small extension of Carbon for determining the fiscal year a date falls into. Don’t reinvent the wheel on that funky date logic where the year starts on, say, July 1st instead of January 1st:

use CarbonExt\FiscalYear\Calculator;

$c = new Calculator(7, 1); // FY starts July 1
$c->get(new Carbon('2026-09-23')); // which FY does this date belong to?

It has been around since 2015, and the last real release was pinned to PHP 5.3, Carbon 1.x, PHPUnit 3.4, and a long-dead Travis CI config.

This time around, instead of hand-crafting the whole modernization like I did for carbon-nbd’s 3.0.0 release, I gave my local LLM a concrete pattern to follow: point it at the modernized carbon-nbd repo as the reference, and have it walk the same checklist on carbon-fy.

It worked surprisingly well. The library is small enough to review every change it proposed, and having a finished example to imitate is a big improvement over open-ended instructions. A handful of prompts, a few review passes, and the test suite is green on modern PHP again.

A nice data point: local AI horsepower plus a good reference pattern makes refreshing a decade-old side project a pleasant afternoon instead of a chore. Find carbon-fy on Packagist or GitHub.