PHPackages                             larafony/clock-carbon - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. larafony/clock-carbon

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

larafony/clock-carbon
=====================

Carbon date/time library bridge for Larafony Framework

1.1.2(5mo ago)00MITPHPPHP ^8.5

Since Dec 23Pushed 5mo agoCompare

[ Source](https://github.com/DJWeb-Damian-Jozwiak/larafony-clock-carbon)[ Packagist](https://packagist.org/packages/larafony/clock-carbon)[ RSS](/packages/larafony-clock-carbon/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

Larafony Carbon Bridge
======================

[](#larafony-carbon-bridge)

This package provides integration between Larafony Framework and [Carbon](https://carbon.nesbot.com/) - the popular PHP date/time library.

Installation
------------

[](#installation)

```
composer require larafony/clock-carbon
```

Usage
-----

[](#usage)

Register the service provider in your `bootstrap.php`:

```
use Larafony\Clock\Carbon\ServiceProviders\CarbonServiceProvider;

$app->withServiceProviders([
    CarbonServiceProvider::class
]);
```

### Basic operations

[](#basic-operations)

```
use Larafony\Clock\Carbon\CarbonClock;
use Larafony\Framework\Web\Application;
use Larafony\Framework\Web\Controller;
use Larafony\Framework\Routing\Advanced\Attributes\Route;
use Larafony\Framework\Http\Factories\ResponseFactory;

final class SomeController extends Controller
{
    #[Route('/some-route')]
    //auto inject from DI container
    public function someAction(CarbonClock $clock): \Psr\Http\Message\ResponseInterface
    {
        //get from application singleton
        $clock2 = Application::get(CarbonClock::class);
        return ResponseFactory::createJsonResponse(
            [
                'now' => $clock->now(),
                'diff' => $clock->now()->diffForHumans()
                'long_day' => $clock->addDays(5)->format('l')
            ]
        );
    }
}
```

### PSR-20 Compatibility

[](#psr-20-compatibility)

The Carbon bridge implements PSR-20 `ClockInterface`, making it a drop-in replacement for Larafony's built-in clock:

```
use Psr\Clock\ClockInterface;

// Works with any PSR-20 compatible code
function doSomething(ClockInterface $clock): void
{
    $now = $clock->now();
    // ...
}
```

Features
--------

[](#features)

- **PSR-20 compatible** - Implements `ClockInterface`
- **Full Carbon API** - Access all Carbon features
- **Timezone support** - Easy timezone manipulation
- **Human-readable dates** - `diffForHumans()` and more
- **Immutable by default** - CarbonImmutable for safety

Why use this bridge?
--------------------

[](#why-use-this-bridge)

While Larafony includes a built-in PSR-20 clock implementation, Carbon offers:

- Rich date/time manipulation API
- Human-readable date differences
- Localization support for 100+ languages
- Date comparison and testing utilities
- Battle-tested codebase used by millions

Learn How It's Built - From Scratch
-----------------------------------

[](#learn-how-its-built---from-scratch)

Interested in **how Larafony is built step by step?**

Check out my full PHP 8.5 course, where I explain everything from architecture to implementation - no magic, just clean code.

Get it now at [masterphp.eu](https://masterphp.eu)

License
-------

[](#license)

MIT License. Larafony-clock-carbon is open-sourced software licensed under the [MIT license](https://opensource.org/license/MIT).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance73

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Total

4

Last Release

152d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/41979fa3adf74e308157185e30a99c93795d8bb8c33f35dbcef030cb3c9865c2?d=identicon)[damek24](/maintainers/damek24)

---

Top Contributors

[![damek24](https://avatars.githubusercontent.com/u/11960180?v=4)](https://github.com/damek24 "damek24 (3 commits)")

---

Tags

clockdatetimecarbonlarafony

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/larafony-clock-carbon/health.svg)

```
[![Health](https://phpackages.com/badges/larafony-clock-carbon/health.svg)](https://phpackages.com/packages/larafony-clock-carbon)
```

###  Alternatives

[illuminate/support

The Illuminate Support package.

630113.0M41.4k](/packages/illuminate-support)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k19](/packages/solspace-craft-freeform)[japanese-date/japanese-date

日本の暦、祝日を取り扱うライブラリ

1610.0k](/packages/japanese-date-japanese-date)[rovangju/carbon-nbd

Carbon DateTime extension to calculate the "next business day"

2125.6k](/packages/rovangju-carbon-nbd)[wilianx7/php-recurring

PHP library for generating recurring dates, schedules, and repeated task recurrences.

1050.7k](/packages/wilianx7-php-recurring)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
