PHPackages                             librevlad/magic-dates - 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. librevlad/magic-dates

ActiveLibrary

librevlad/magic-dates
=====================

Work in progress

152[1 PRs](https://github.com/librevlad/magic-dates/pulls)PHPCI passing

Since Feb 3Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/librevlad/magic-dates)[ Packagist](https://packagist.org/packages/librevlad/magic-dates)[ RSS](/packages/librevlad-magic-dates/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (3)Used By (0)

Magic Dates
===========

[](#magic-dates)

Adds magic methods to your Eloquent query builder to work with dates.

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

[](#installation)

You can install the package via composer:

```
composer require librevlad/magic-dates
```

Usage
-----

[](#usage)

Works only with fields explicitly declared on the $dates property of your model.

```
class Order extends Model {

    protected $dates = [
        'created_at',
        'updated_at',
        'shipped_at',
    ];

    /**  **/

}
```

```
   // same thing as ->where('created_at','>', now()->subWeek() )
   $orders = Order::createdSince( now()->subWeek() );

   // same thing as ->where('updated_at','>', now()->subWeek() )
   $orders = Order::updatedAfter( now()->subWeek() );

   // same thing as ->whereBetween('shipped_at', now()->subWeek(), now() )
   $orders = Order::shippedBetween( now()->subYear(), now() );
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance61

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8dc28970580d50f2b4bb813e767ed7b0eefd6481037cd83ebc97ca63a7dae95b?d=identicon)[librevlad](/maintainers/librevlad)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/librevlad-magic-dates/health.svg)

```
[![Health](https://phpackages.com/badges/librevlad-magic-dates/health.svg)](https://phpackages.com/packages/librevlad-magic-dates)
```

PHPackages © 2026

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