devsmo/php-hetu 问题修复 & 功能扩展

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

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

devsmo/php-hetu

最新稳定版本:v1.2.0

Composer 安装命令:

composer require devsmo/php-hetu

包简介

PHP Hetu validator. Hetu stands for Henkilötunnus aka Finnish Social Security Number

README 文档

README

codecov

Finnish Social Security number validator.

This simple class validates social security numbers and provides methods for checking birthdate, age and gender based on the 'hetu'.

Requirements

  • PHP >= 8.0

Installation

The recommended way is to install the lib through Composer.

composer require devsmo/php-hetu

Or you can add this to your composer.json

{
    "require": {
        "devsmo/php-hetu": "^1.0"
    }
}

Usage

The hetu class creates an immutable value object. You can initialize the object in two ways:

<?php

$hetu = Devsmo\Hetu::create('041281-981T');

if ( $hetu ) {
	echo "It's valid";
}
else {
	echo "It's not valid...";
}

Or if you want to catch possible errors:

<?php

try {
	$hetu = new Devsmo\Hetu('041281-981T');
}
catch (\InvalidArgumentException $e){
	$msg = $e->getMessage();
}

The class has three methods:

<?php
$age = $hetu->getAge(); // 35

$date_of_birth = $hetu->getDateStr(); // 1981-12-04

$gender = $hetu->getGender(); // male

Contribution

Feel free to contribute! Just create a new issue or a new pull request.

License

This library is released under the MIT License.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固