PHPackages                             genealabs/laravel-null-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. genealabs/laravel-null-carbon

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

genealabs/laravel-null-carbon
=============================

A Laravel Carbon null-class.

11.0.2(2y ago)56314.0k↓73.5%[1 PRs](https://github.com/mikebronner/laravel-null-carbon/pulls)MITPHPCI passing

Since Jan 29Pushed 3mo agoCompare

[ Source](https://github.com/mikebronner/laravel-null-carbon)[ Packagist](https://packagist.org/packages/genealabs/laravel-null-carbon)[ GitHub Sponsors](https://github.com/mikebronner)[ RSS](/packages/genealabs-laravel-null-carbon/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (2)Versions (18)Used By (0)

Null-Carbon For Laravel
=======================

[](#null-carbon-for-laravel)

[![NUll-Carbon for Laravel masthead image.](https://repository-images.githubusercontent.com/119314805/59692e80-f341-11e9-86d0-068d0824e96d)](https://repository-images.githubusercontent.com/119314805/59692e80-f341-11e9-86d0-068d0824e96d)

Goal
----

[](#goal)

Methods should always return only one data-type. This principle is broken if a method returns both `null` and some other data-type, so the solution is to return a null-class. The `NullCarbon` class is a null-class implementation of Laravel's Carbon class.

Prerequisites
-------------

[](#prerequisites)

- PHP 8.2, 8.3, 8.4, 8.5
- Laravel &gt;= 11.0

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

[](#installation)

```
composer require genealabs/laravel-null-carbon

```

Usage
-----

[](#usage)

The following is an example of how to use the `NullCarbon` class for date fields on a model:

```
use GeneaLabs\LaravelNullCarbon\NullCarbon;
use Illuminate\Support\Carbon;

class MyModel
{
    protected $dates = [
        'published_at',
    ];

    public function getPublishedAtAttribute() : Carbon
    {
        return $this->published_at
            ?: new NullCarbon;
    }
}
```

The Fine Print
==============

[](#the-fine-print)

Commitment to Quality
---------------------

[](#commitment-to-quality)

During package development I try as best as possible to embrace good design and development practices to try to ensure that this package is as good as it can be. My checklist for package development includes:

- ✅ Achieve as close to 100% code coverage as possible using unit tests.
- ✅ Eliminate any issues identified by SensioLabs Insight and Scrutinizer.
- ✅ Be fully PSR1, PSR2, and PSR4 compliant.
- ✅ Include comprehensive documentation in README.md.
- ✅ Provide an up-to-date CHANGELOG.md which adheres to the format outlined at .
- ✅ Have no PHPMD or PHPCS warnings throughout all code.

Contributing
------------

[](#contributing)

Please observe and respect all aspects of the included Code of Conduct [https://github.com/GeneaLabs/laravel-caffeine/blob/master/CODE\_OF\_CONDUCT.md](https://github.com/GeneaLabs/laravel-caffeine/blob/master/CODE_OF_CONDUCT.md).

### Reporting Issues

[](#reporting-issues)

When reporting issues, please fill out the included template as completely as possible. Incomplete issues may be ignored or closed if there is not enough information included to be actionable.

### Submitting Pull Requests

[](#submitting-pull-requests)

Please review the Contribution Guidelines . Only PRs that meet all criterium will be accepted.

❤️ Open-Source Software - Give ⭐️
---------------------------------

[](#️-open-source-software---give-️)

We have included the awesome `symfony/thanks` composer package as a dev dependency. Let your OS package maintainers know you appreciate them by starring the packages you use. Simply run `composer thanks` after installing this package. (And not to worry, since it's a dev-dependency it won't be installed in your live environment.)

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance54

Moderate activity, may be stable

Popularity45

Moderate usage in the ecosystem

Community6

Small or concentrated contributor base

Maturity72

Established project with proven stability

 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 ~179 days

Recently: every ~212 days

Total

14

Last Release

746d ago

Major Versions

0.5.0 → 10.0.02023-05-20

10.0.0 → 11.0.02024-06-18

PHP version history (2 changes)0.1.0PHP &gt;=7.0.0

0.1.3PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/4374bfc5d8583aa8c25c5080f1fcfaf09027822f47724ba6b64abc564945c80a?d=identicon)[mikebronner](/maintainers/mikebronner)

---

Top Contributors

[![mikebronner](https://avatars.githubusercontent.com/u/1791050?v=4)](https://github.com/mikebronner "mikebronner (30 commits)")

### Embed Badge

![Health badge](/badges/genealabs-laravel-null-carbon/health.svg)

```
[![Health](https://phpackages.com/badges/genealabs-laravel-null-carbon/health.svg)](https://phpackages.com/packages/genealabs-laravel-null-carbon)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M10](/packages/renatomarinho-laravel-page-speed)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.6M377](/packages/illuminate-redis)[illuminate/cookie

The Illuminate Cookie package.

244.6M137](/packages/illuminate-cookie)

PHPackages © 2026

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