PHPackages                             laborci/valentine-date - 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. laborci/valentine-date

ActiveLibrary

laborci/valentine-date
======================

1.0(7y ago)11303PHPPHP &gt;=7.0

Since Feb 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/laborci/valentine-date)[ Packagist](https://packagist.org/packages/laborci/valentine-date)[ RSS](/packages/laborci-valentine-date/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (3)

Valentine date
==============

[](#valentine-date)

Implementation of the missing Date class

Read only properties
--------------------

[](#read-only-properties)

```
int $year
int $month
int $day

string $month00
	// the month with leading zeroes (01-12)
string $day00
	// the day with leading zeroes (01-31)

int $dayOfWeek
	// starts with Sunday indexed from 0
int $dayOfWeekISO
	// starts with Monday indexed from 0
int $dayOfWeekM0
	// starts with Monday indexed from 0
int $dayOfWeekM1
	// starts with Monday indexed from 1
int $dayOfWeekS0
	// starts with Sunday indexed from 0
int $dayOfWeekS1
	// starts with Sunday indexed from 1

int $week
	// ISO-8601 week number of year, weeks starting on Monday
int $yearOfWeek
	// the year of week can be different from the date’s year

bool $isLeapYear
	// whether it's a leap year
int $dayOfYear
	// the day of the year (starting from 0)
int $days
	// number of days in the given month

```

Instantiation
-------------

[](#instantiation)

```
public function __construct(string $date = 'today', $format = 'Y-m-d')
	// http://php.net/manual/en/datetime.createfromformat.php

static createFromFormat(string $date = 'today', $format = 'Y-m-d'): self
static createFromDateTime(\DateTime $date): self
static createFromWeek($year, $week, $day = 1): self

```

Creating Copies
---------------

[](#creating-copies)

```
copyMutable(): Date
copyImmutable(): DateImmutable
copy(): self

```

Stringify
---------

[](#stringify)

```
format($format):string
__toString():string // Y-m-d

```

Diff two dates
--------------

[](#diff-two-dates)

```
diff(Date|DateImmutable $diff):\DateInterval
diffDays(Date|DateImmutable $diff):int
	// returns signed integer

```

Get the \\DateTime object
-------------------------

[](#get-the-datetime-object)

- Date returns the embedded \\DateTime object
- DateImmutable returns a copy of the \\DateTime object

```
getDate(): \DateTime;

```

Modify Dates (not available in DateImmutable)
---------------------------------------------

[](#modify-dates-not-available-in-dateimmutable)

```
modify($modify): $this;
	// http://php.net/manual/en/datetime.modify.php

add(int $year = 0, int $month = 0, int $day = 0, int $week = 0): $this;
sub(int $year = 0, int $month = 0, int $day = 0, int $week = 0): $this;
	// adds and subtracts years, months, days, weeks from/to the current date

setDate($year = null, $month = null, $day = null): $this
setWeek($week = null, $day = null, $year = null): $this;
	// if any argument’s value is null, it refers the current year, day, week, month

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity54

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

Unknown

Total

1

Last Release

2641d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/66d6c319c7aaec0983a01e417b163694e8dca501b6a8ec82e1f5e2a03c88b2d6?d=identicon)[elvis](/maintainers/elvis)

---

Top Contributors

[![laborci](https://avatars.githubusercontent.com/u/7274872?v=4)](https://github.com/laborci "laborci (2 commits)")

### Embed Badge

![Health badge](/badges/laborci-valentine-date/health.svg)

```
[![Health](https://phpackages.com/badges/laborci-valentine-date/health.svg)](https://phpackages.com/packages/laborci-valentine-date)
```

PHPackages © 2026

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