PHPackages                             tourze/ga-t-2000 - 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. tourze/ga-t-2000

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

tourze/ga-t-2000
================

GA/T 2000 公安信息代码

0.0.3(11mo ago)08MITPHPPHP ^8.1CI passing

Since Mar 24Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/tourze/ga-t-2000)[ Packagist](https://packagist.org/packages/tourze/ga-t-2000)[ RSS](/packages/tourze-ga-t-2000/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

GA/T 2000 Public Security Information Code
==========================================

[](#gat-2000-public-security-information-code)

[![Latest Version](https://camo.githubusercontent.com/0ce709efa7ddb97ce8861408ff197afa07b73ec9edf78dbef975412d96b8889a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f67612d742d323030302e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/ga-t-2000)[![PHP Version](https://camo.githubusercontent.com/24d175b330143f4ff746eb8570722d5df1dc48f3b4773e8f5cad82d255f902b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f67612d742d323030302e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Build Status](https://camo.githubusercontent.com/286589604dca3f3ee11f45c38dd89d4825e9780248f10919dbaf3a3be8ee32b7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f75727a652f67612d742d323030302f63692e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://github.com/tourze/ga-t-2000/actions)[![Quality Score](https://camo.githubusercontent.com/2b4bd533ac9f4696b3298b023ec02a34503467a40cc9b9eeb7304c69772c2a8c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f67612d742d323030302e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/ga-t-2000)[![Total Downloads](https://camo.githubusercontent.com/32534b62303734f7f2cfee1ef12875a07bd141ad2d6ef79cdee05e51e8af5fc6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f67612d742d323030302e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/ga-t-2000)[![License](https://camo.githubusercontent.com/5deabcd472a07602d9e95e979258e5d13af2bc4c2a26172f2b31c72f80b9933e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f67612d742d323030302e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/ga-t-2000)[![Coverage Status](https://camo.githubusercontent.com/73ee3bab50824f778cedc6b4b3f78bcdab621eef812a979ec388b8ad692a4bff/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f746f75727a652f7068702d6d6f6e6f7265706f2e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/tourze/php-monorepo)

[English](README.md) | [中文](README.zh-CN.md)

A PHP package that implements GA/T 2000 (Public Security Information Code) standards, providing type-safe enums for various document related codes.

Features
--------

[](#features)

- Complete implementation of GA/T 2000.156-2016 document type codes
- Type-safe PHP 8.1+ enums with strict typing
- Comprehensive Chinese labels for all codes
- Additional remarks for special document types
- Easy integration with forms and data validation
- PSR-4 compliant autoloading
- Minimal dependencies: PHP 8.1+ and tourze/enum-extra

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require tourze/ga-t-2000
```

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Composer for dependency management

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
use Tourze\GAT2000\DocumentType;

// Get document type code
$code = DocumentType::ID_CARD->value; // '111'

// Get document type label in Chinese
$label = DocumentType::ID_CARD->getLabel(); // '身份证'

// Get document type remark (if available)
$remark = DocumentType::TEMP_ENTRY_EXIT_CARD->getRemark(); // '临时出入内部单位证'

// Convert to array
$array = DocumentType::ID_CARD->toArray();
// ['value' => '111', 'label' => '身份证']
```

### Working with Forms

[](#working-with-forms)

```
use Tourze\GAT2000\DocumentType;

// Generate options for select dropdown
$options = DocumentType::genOptions();
// [
//     ['label' => '身份证', 'text' => '身份证', 'value' => '111', 'name' => '身份证'],
//     ['label' => '临时身份证', 'text' => '临时身份证', 'value' => '112', 'name' => '临时身份证'],
//     // ... more options
// ]

// Get select item for specific document type
$selectItem = DocumentType::ID_CARD->toSelectItem();
// ['label' => '身份证', 'text' => '身份证', 'value' => '111', 'name' => '身份证']
```

### Type Conversion

[](#type-conversion)

```
use Tourze\GAT2000\DocumentType;

// Convert from string value (throws exception if invalid)
$type = DocumentType::from('111'); // DocumentType::ID_CARD

// Try to convert from string value (returns null if invalid)
$type = DocumentType::tryFrom('111'); // DocumentType::ID_CARD
$type = DocumentType::tryFrom('999'); // null

// Get all document types as array
$types = DocumentType::items(); // ['111' => '身份证', '112' => '临时身份证', ...]
```

### Environment-based Filtering

[](#environment-based-filtering)

```
// You can filter options using environment variables
$_ENV['enum-display:' . DocumentType::class . '-111'] = false; // Hide ID_CARD
$filteredOptions = DocumentType::genOptions(); // ID_CARD won't appear in options
```

Available Document Types
------------------------

[](#available-document-types)

The package includes all standard document types defined in GA/T 2000.156-2016, including but not limited to:

- Identity documents (ID cards, passports, etc.)
- Professional certificates (police, judge, lawyer cards, etc.)
- Border control documents
- Special permits and licenses
- Organization and business documents

API Reference
-------------

[](#api-reference)

### DocumentType Enum

[](#documenttype-enum)

The `DocumentType` enum implements the following interfaces:

- `Labelable` - Provides `getLabel()` method for Chinese labels
- `Itemable` - Provides `toArray()` and `items()` methods
- `Selectable` - Provides `toSelectItem()` and `genOptions()` methods for form integration

### Methods

[](#methods)

- `getLabel(): string` - Returns the Chinese label for the document type
- `getRemark(): ?string` - Returns additional remarks for specific document types (if available)
- `toArray(): array` - Converts the enum to an array with 'value' and 'label' keys
- `toSelectItem(): array` - Converts the enum to a select item array
- `items(): array` - Returns all document types as an associative array
- `genOptions(): array` - Generates options array for select dropdowns

Testing
-------

[](#testing)

```
# Run tests from project root
./vendor/bin/phpunit packages/ga-t-2000/tests

# Run PHPStan analysis
php -d memory_limit=2G ./vendor/bin/phpstan analyse packages/ga-t-2000
```

Changelog
---------

[](#changelog)

### \[0.1.0\] - 2024-01-01

[](#010---2024-01-01)

- Initial release with complete GA/T 2000.156-2016 document type codes
- Type-safe PHP 8.1+ enum implementation
- Chinese label support for all document types
- Integration with form generation utilities
- Environment-based option filtering

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance60

Regular maintenance activity

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

Every ~33 days

Total

3

Last Release

348d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-ga-t-2000/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-ga-t-2000/health.svg)](https://phpackages.com/packages/tourze-ga-t-2000)
```

PHPackages © 2026

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