{"id":13450796,"url":"https://github.com/ofcold/identity-card","last_synced_at":"2025-04-04T18:08:08.473Z","repository":{"id":37622912,"uuid":"111262347","full_name":"ofcold/identity-card","owner":"ofcold","description":"A simple proof of identity card of the people's Republic of China.","archived":false,"fork":false,"pushed_at":"2023-07-14T11:30:06.000Z","size":325,"stargazers_count":189,"open_issues_count":2,"forks_count":32,"subscribers_count":4,"default_branch":"3.0","last_synced_at":"2025-03-28T17:08:35.445Z","etag":null,"topics":["codeigniter","fuel","id-card","idcard","identitycard","laravel","phalcon","php71","symfony","thinkphp","yii"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ofcold.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-19T03:51:48.000Z","updated_at":"2024-11-17T02:15:44.000Z","dependencies_parsed_at":"2024-07-31T07:12:30.114Z","dependency_job_id":null,"html_url":"https://github.com/ofcold/identity-card","commit_stats":{"total_commits":84,"total_committers":7,"mean_commits":12.0,"dds":0.5357142857142857,"last_synced_commit":"df7b6d3a8c6d7768094ce15f2802194637513ad4"},"previous_names":[],"tags_count":33,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofcold%2Fidentity-card","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofcold%2Fidentity-card/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofcold%2Fidentity-card/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofcold%2Fidentity-card/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ofcold","download_url":"https://codeload.github.com/ofcold/identity-card/tar.gz/refs/heads/3.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226215,"owners_count":20904465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeigniter","fuel","id-card","idcard","identitycard","laravel","phalcon","php71","symfony","thinkphp","yii"],"created_at":"2024-07-31T07:00:38.632Z","updated_at":"2025-04-04T18:08:08.440Z","avatar_url":"https://github.com/ofcold.png","language":"PHP","funding_links":[],"categories":["插件推荐"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/ofcold/identity-card/raw/2.0/id-card.svg?sanitize=true\"\u003e\u003c/p\u003e\n\n\n[![996.icu](https://img.shields.io/badge/link-996.icu-red.svg?style=flat-square)](https://996.icu)\n[![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg?style=flat-square)](https://github.com/996icu/996.ICU/blob/master/LICENSE)\n![](https://img.shields.io/github/stars/ofcold/identity-card.svg?style=flat-square)\n[![Total Downloads](https://poser.pugx.org/ofcold/identity-card/downloads?format=flat-square)](https://packagist.org/packages/ofcold/identity-card)\n\n\nChina (region) citizen ID card tool\n------------------------\n\u003cbr\u003e\n    \u003cp\u003e\n        \u003ca href=\"https://github.com/ofcold/identity-card/blob/2.0/README_zh_CN.md\"\u003eSimplified Chinese Documentation\u003c/a\u003e\n    \u003c/p\u003e\n\u003cbr\u003e\n\n\n\u003e  China (Mainland) ID card package, the data from the national standard `GB/T 2260-2007`  \u003ca href=\"http://www.stats.gov.cn\" target=\"_blank\"\u003e (People's Republic of China administrative divisions code standard).\u003c/a\u003e\n\n## Other Language\n- [.NET Rep](https://gitee.com/mick666/identity-card.NET)\n\n## Installing\n\n```bash\n\n    composer require ofcold/identity-card\n```\n\n\n## Instructions\nA component based on People's Republic of China citizen ID card to obtain the user information.This works for any php framework, but only if the php version is greater than 7.1.\n\n## Useing\n\n### Useing in Laravel Validation\n\n\u003e Multi-language add `Please enter a valid Id Card` to your json language package.\n\n```php\n\nuse Ofcold\\IdentityCard\\Rules\\IdCard;\n\n/**\n * Get the validation rules that apply to the request.\n *\n * @return array\n */\npublic function rules()\n{\n    return [\n        'id_card'  =\u003e [\n            'required',\n            new IdCard\n        ]\n    ];\n}\n```\n\n#### Verify your Chinese ID card\n```php\n\n    // Result false OR Ofcold\\IdentityCard\\IdentityCard instance.\n    $result = Ofcold\\IdentityCard\\IdentityCard::make('32010619831029081');\n\n    if ( $result === false ) {\n\n        return 'Your ID number is incorrect';\n    }\n\n    print_r($result-\u003etoArray());\n\n\n```\n\n#### OR test file.\n```bash\n    php test\n```\n\n\n```php\n\n$idCard = Ofcold\\IdentityCard\\IdentityCard::make('320106198310290811', 'en');\n//  Use locale, Current supported zh-cn,en\n// $idCard = Ofcold\\IdentityCard\\IdentityCard::make('320106198310290811', 'zh-cn');\nif ( $idCard === false ) {\n\n    return 'Your ID number is incorrect';\n}\n$area = $idCard-\u003egetArea();\n$gender = $idCard-\u003egetGender();\n$birthday = $idCard-\u003egetBirthday();\n$age = $idCard-\u003egetAge();\n$constellation = $idCard-\u003egetConstellation();\n```\n\n\n#### Results:\n```json\n{\n    \"area\": \"shan xi sheng yun cheng di qu yun cheng shi\",\n    \"province\": \"shan xi sheng\",\n    \"city\": \"yun cheng di qu\",\n    \"county\": \"yun cheng shi\",\n    \"gender\": \"Male\",\n    \"birthday\": \"1980-03-12\",\n    \"zodiac\": \"Pig\",\n    \"age\": 38,\n    \"constellation\": \"Pisces\"\n}\n```\n\n### Api\n- getArea() : string `Get Area`\n- getConstellation() : string `Get constellation`\n- getZodiac() : string `Get zodiac`\n- getAge() : int `Get age`\n- getBirthday(string $foramt = 'Y-m-d') : string `Get birthday`\n- getGender() : string `Get gender`\n- getCounty() : string|null `Get county`\n- getCity() : string|null `Get city`\n- getProvince() : string|null `Get province`\n- toArray() : array `Get all information.`\n- toJson(int $option) : string `Json format all information`\n- __get() : mixed\n- __toString() : toJson\n\n\n## CHANGELOG\n\n### V3.0.0\n- Added Laravel Rule.\n\n### V2.0.0\n* Added [#2](https://github.com/ofcold/identity-card/pull/2) __get()\n* Added [#2](https://github.com/ofcold/identity-card/pull/2) __toString()\n* Modifed [#2](https://github.com/ofcold/identity-card/pull/2) static make() Method returns the current object or boolean type\n* Removed [#2](https://github.com/ofcold/identity-card/pull/2) Construction method exception verification\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofcold%2Fidentity-card","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fofcold%2Fidentity-card","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofcold%2Fidentity-card/lists"}