PHPackages                             joskolenberg/eloquent-empty-date-nullifier - 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. [Database &amp; ORM](/categories/database)
4. /
5. joskolenberg/eloquent-empty-date-nullifier

AbandonedLibrary[Database &amp; ORM](/categories/database)

joskolenberg/eloquent-empty-date-nullifier
==========================================

Convert 0000-00-00 dates in the database to null when accessing your model's attributes.

v1.0(6y ago)028MITPHP

Since Jun 18Pushed 6y agoCompare

[ Source](https://github.com/joskolenberg/eloquent-empty-date-nullifier)[ Packagist](https://packagist.org/packages/joskolenberg/eloquent-empty-date-nullifier)[ RSS](/packages/joskolenberg-eloquent-empty-date-nullifier/feed)WikiDiscussions master Synced today

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

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7c6bd84431944d4012354f438219b2ab7641c62ef2a3b28be29b18a430aea20a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6f736b6f6c656e626572672f656c6f7175656e742d656d7074792d646174652d6e756c6c69666965722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/joskolenberg/eloquent-empty-date-nullifier/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/3d5a3a30d906b69cfc78fb3fa46000714ed0d64edd735e1638c5b42e280bde8f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6f736b6f6c656e626572672f656c6f7175656e742d656d7074792d646174652d6e756c6c69666965722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/joskolenberg/eloquent-empty-date-nullifier/?branch=master)[![Build Status](https://camo.githubusercontent.com/d779a6b9b5e86e02a86613f9489da5bbe1f8318b299d9cd211db8ee44b935e7d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6f736b6f6c656e626572672f656c6f7175656e742d656d7074792d646174652d6e756c6c69666965722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/joskolenberg/eloquent-empty-date-nullifier/build-status/master)[![Total Downloads](https://camo.githubusercontent.com/fd6abee52d4dd6dbb699b0abf880fd5f0499d48153daf834818fff805a83e67a/68747470733a2f2f706f7365722e707567782e6f72672f6a6f736b6f6c656e626572672f656c6f7175656e742d656d7074792d646174652d6e756c6c69666965722f646f776e6c6f616473)](https://packagist.org/packages/joskolenberg/eloquent-empty-date-nullifier)[![Latest Stable Version](https://camo.githubusercontent.com/bfc948deb6dd2fc552f99416bf96469236fc727915ba30ac9b578c0b7cdb3698/68747470733a2f2f706f7365722e707567782e6f72672f6a6f736b6f6c656e626572672f656c6f7175656e742d656d7074792d646174652d6e756c6c69666965722f762f737461626c65)](https://packagist.org/packages/joskolenberg/eloquent-empty-date-nullifier)[![License](https://camo.githubusercontent.com/05d7dffeb8f6d08282fe2a068b0f5d7fd8339b02be86cd705a7003a10703410a/68747470733a2f2f706f7365722e707567782e6f72672f6a6f736b6f6c656e626572672f656c6f7175656e742d656d7074792d646174652d6e756c6c69666965722f6c6963656e7365)](https://packagist.org/packages/joskolenberg/eloquent-empty-date-nullifier)

Eloquent Empty Date Nullifier
=============================

[](#eloquent-empty-date-nullifier)

Little trait to convert "0000-00-00" dates in the database to null when you access them using Eloquent models, useful when you have to deal with (legacy) polluted data.

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

[](#installation)

```
composer require joskolenberg/eloquent-empty-date-nullifier

```

Usage
-----

[](#usage)

Add the `JosKolenberg\EloquentEmptyDateNullifier\NullifiesEmptyDates` trait to your model, and all your 0000-00-00 dates will be converted to null when accessing them using your eloquent model and during serialization.

```
use Illuminate\Database\Eloquent\Model;
use JosKolenberg\EloquentEmptyDateNullifier\NullifiesEmptyDates;

class Person extends Model
{
    use NullifiesEmptyDates;

    protected $dates = [
        'date_of_birth',
    ];
}
```

Example:

```
$person = new Person();

$person->setRawAttributes([
	'date_of_birth' => '0000-00-00',
]);

$person->date_of_birth; // = null
```

Notes
-----

[](#notes)

"0000-00-00" dates can be present in a database when empty values are stored but the column is not set to be nullable. The recommended approach is to make the column nullable and convert all the empty values to null in the database. However, this might not always be possible e.g. when other (external) applications rely on the same data. In that case this package may come in handy.

That's it! Any suggestions or issues? Please contact me!

Happy coding!

Jos Kolenberg

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

4

Last Release

2442d ago

Major Versions

v0.2.1 → v1.02019-09-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9663e81340dcce520845c908f741986ab8e1b24c3a519cfec45677dbabe9a57?d=identicon)[joskolenberg](/maintainers/joskolenberg)

---

Tags

laraveleloquentdatedates

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/joskolenberg-eloquent-empty-date-nullifier/health.svg)

```
[![Health](https://phpackages.com/badges/joskolenberg-eloquent-empty-date-nullifier/health.svg)](https://phpackages.com/packages/joskolenberg-eloquent-empty-date-nullifier)
```

###  Alternatives

[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)

PHPackages © 2026

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