PHPackages                             reload/cpr - 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. reload/cpr

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

reload/cpr
==========

CPR: Danish personal identification numbers

v0.0.151(1mo ago)2109MITPHPPHP ^8.3CI passing

Since Dec 6Pushed 1mo agoCompare

[ Source](https://github.com/reload/cpr)[ Packagist](https://packagist.org/packages/reload/cpr)[ Docs](https://github.com/reload/cpr)[ RSS](/packages/reload-cpr/feed)WikiDiscussions main Synced 1mo ago

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

CprNumber
=========

[](#cprnumber)

A class representing Danish civil registration numbers (CPR numbers).

The CPR number is a ten digit number with the format DDMMYY-SSSS, where the first six digits represent the date of birth and the last four digits are a sequence number.

The CPR number is used in Denmark to uniquely identify persons in various systems, and is also used as a personal identification number in many contexts.

The class represents a CPR number as a read-only value object, and provides methods for working with, formatting, and validating CPR numbers.

- Full name: `\Reload\Cpr\CprNumber`

Methods
-------

[](#methods)

### \_\_construct

[](#__construct)

Construct a CPR number readonly value object from a string.

```
public __construct(string $cpr)
```

**Parameters:**

ParameterTypeDescription`$cpr`**string**A string with the CPR number.**Throws:**

If the CPR number does not contain 10 digits

- [`InvalidCprNumberFormat`](src/Exception/InvalidCprNumberFormat.php)If the date in the CPR number doesn't exist.
- [`NonExistingDate`](src/Exception/NonExistingDate.php)

### \_\_toString

[](#__tostring)

Format the CPR number in the traditional format (120345-6789).

```
public __toString(): string
```

**See Also:**

- \\Reload\\Cpr\\CprNumber::formatPretty()

### formatPretty

[](#formatpretty)

Format the CPR number in the traditional format (120345-6789).

```
public formatPretty(): string
```

### formatNumbersOnly

[](#formatnumbersonly)

Format the CPR number using numbers only (1203456789).

```
public formatNumbersOnly(): string
```

### isFemale

[](#isfemale)

Check if the CPR number represents a female person.

```
public isFemale(): bool
```

### isMale

[](#ismale)

Check if the CPR number represents a male person.

```
public isMale(): bool
```

### getDateTimeImmutable

[](#getdatetimeimmutable)

Get a DateTimeImmutable object from the CPR number.

```
public getDateTimeImmutable(?\DateTimeZone $timezone = null): ?\DateTimeImmutable
```

**Parameters:**

ParameterTypeDescription`$timezone`**?\\DateTimeZone**A DateTimeZone object for the desired time zone. Defaults: current timezone.### validateModulus11

[](#validatemodulus11)

Validate the CPR number using the modulus 11 algorithm.

```
public validateModulus11(): bool
```

NOTICE: CPR numbers are no longer required to fulfill the modulus 11 check. You should NOT use this method to validate or dismiss CPR numbers.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance90

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 76.9% 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 ~3 days

Total

150

Last Release

47d ago

PHP version history (2 changes)v0.0.1PHP ^8.2

v0.0.27PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (240 commits)")[![arnested](https://avatars.githubusercontent.com/u/190005?v=4)](https://github.com/arnested "arnested (72 commits)")

---

Tags

civil-registrationcpr-nummerdenmarkpersonal-identification-numberphpphp-library

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/reload-cpr/health.svg)

```
[![Health](https://phpackages.com/badges/reload-cpr/health.svg)](https://phpackages.com/packages/reload-cpr)
```

PHPackages © 2026

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