miladk/bekrafta 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

miladk/bekrafta

Composer 安装命令:

composer require miladk/bekrafta

包简介

Validate Personal Numbers

README 文档

README

Bekräfta: A PHP library to perform common operations on Personal Identification Numbers, like: Validation, censoring the individual digits, calculating age and detecting gender.

Supported Countries

  • Denmark (CPR-Nummer)
  • Finland (Henkilötunnus, Personbeteckning)
  • Poland (PESEL)
  • Netherlands (Burgerservicenummer) Validation only
  • Norway (Fødselsnummer)
  • Sweden (Personnummer)

Supported Countries

Supported PHP Versions

  • PHP 7.0
  • PHP 7.1
  • PHP 7.2

Installation

composer require miladk/bekrafta

Usage

This library offers one interface for all supported countries. Developers don't have to use specific countries' classes, instead there is one class that detects and uses the country and serves the appropriate values.

use Bekrafta\PersonalNumber;

$oPN = new PersonalNumber('811228-9874');

// True on successful detection, false otherwise.
// True also means a valid personal number.
$oPN->detect();

// 811228-****
$oPN->getCensored();

// 35
$oPN->getAge();

// m
$oPN->getGender();

// 1981
$oPM->getYear();

// 1981-12-28
$oPM->getBirthday()

Or you can use a specific country if you only need that.

use Bekrafta\Sweden;

$oSweden = new Sweden('811228-9874');

// True on valid personal number, false otherwise.
$oSweden->validate();

// 811228-****
$oSweden->getCensored();

// 35
$oSweden->getAge();

// m
$oSweden->getGender();

// 1981
$oSweden->getYear();

// 1981-12-28
$oSweden->getBirthday();

Sweden Extended

In Sweden, some companies add the century digits as a part of the personal number, or remove the symbol between the date of birth and the four other digits. These changes are not part of the standard of the official standard. So I included to classes for Sweden:

  • Sweden: Supports the official standard format.
  • SwedenExtended: Supports the popular non-standard formats. This has two more functions:
    • removeLeadingCenturies() it removes the leading 19 or 20 from the personal number.
    • removeNonNumbers() Removes non-numeric characters form personal number.

Denmark Strict

However, in 2007 the available sequence numbers under this system for males born on 1 January 1965 ran out, and since October 2007 personal identification numbers do not always validate using the check digit. This had been predicted and announced several years in advance. Thus, most IT systems are presumed updated to accept numbers that fail the check-digit validation. — Wikipedia

Therefore, I see no use for performing a checksum on Danish personal numbers, because we will get false negatives. However, if you want to use the checksum, you can use the class DenmarkStrict which performs the checksum on the personal number, you will get false positives though.

License

MIT

miladk/bekrafta 适用场景与选型建议

miladk/bekrafta 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20.4k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 02 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 miladk/bekrafta 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 miladk/bekrafta 我们能提供哪些服务?
定制开发 / 二次开发

基于 miladk/bekrafta 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 20.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-25