PHPackages                             arslanimamutdinov/iso-standard-utilities - 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. arslanimamutdinov/iso-standard-utilities

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

arslanimamutdinov/iso-standard-utilities
========================================

v1.0.1(4y ago)12.9k2MITPHP

Since Sep 29Pushed 4y ago1 watchersCompare

[ Source](https://github.com/arslanim/iso-standard-utilities)[ Packagist](https://packagist.org/packages/arslanimamutdinov/iso-standard-utilities)[ RSS](/packages/arslanimamutdinov-iso-standard-utilities/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (2)

ISO standard utilities
======================

[](#iso-standard-utilities)

[![Code Coverage Badge](./badge.svg)](./badge.svg)

This component provides features for supporting search iso standards raw data by attributes.

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

[](#installation)

```
composer require arslanimamutdinov/iso-standard-utilities
```

Terms and designations
----------------------

[](#terms-and-designations)

- alpha2 - two-letter codes (recommended as the general-purpose code);
- alpha3 - three-letter codes;
- numericCodes - numeric codes;
- name - string name.

Component parts description
---------------------------

[](#component-parts-description)

AttributeCode - class, containing iso attributes constants. Details:

- AttributeCodes::ATTRIBUTE\_ALPHA2 - represents two-letter code attribute;
- AttributeCodes::ATTRIBUTE\_ALPHA3 - represents three-letter code attribute;
- AttributeCodes::ATTRIBUTE\_NAME - represents string name format attribute;
- AttributeCodes::ATTRIBUTE\_NUMERIC\_CODE - represents three-digit numeric code (which can be useful if you need to avoid using Latin script).

StandardSearchUtility - class provides set of function for working with raw data standards.

StandardSearchUtilityService - service class wrapper over StandardSearchUtility.

### getByAlpha2

[](#getbyalpha2)

```
public static function getByAlpha2(
    array $standardsData,
    string $alpha2
): ?array;
```

```
public function getByAlpha2(
    array $standardsData,
    string $alpha2
): ?array;
```

Input:

- $standardsData - array standards raw dataset;
- $alpha2 - two-letter code value;

Return: found standard raw array data, suitable to input two-letter code value (or null if not found).

#### Examples

[](#examples)

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getByAlpha2($rawStandardsData, 'AU');
var_dump($result);

array(4) {
  ["name"]=>
  string(9) "Australia"
  ["alpha2"]=>
  string(2) "AU"
  ["alpha3"]=>
  string(3) "AUS"
  ["numericCode"]=>
  string(3) "036"
}

$result = StandardSearchUtility::getByAlpha2($rawStandardsData, 'RU');
var_dump($result);

NULL

$service = new StandardSearchUtilityService();

$result = $service->getByAlpha2($rawStandardsData, 'AU');
var_dump($result);

array(4) {
  ["name"]=>
  string(9) "Australia"
  ["alpha2"]=>
  string(2) "AU"
  ["alpha3"]=>
  string(3) "AUS"
  ["numericCode"]=>
  string(3) "036"
}

$result = $service->getByAlpha2($rawStandardsData, 'RU');
var_dump($result);

NULL
```

### getByAlpha3

[](#getbyalpha3)

```
public static function getByAlpha3(
    array $standardsData,
    string $alpha3
): ?array;
```

```
public function getByAlpha3(
    array $standardsData,
    string $alpha3
): ?array;
```

Input:

- $standardsData - array standards raw dataset;
- $alpha3 - three-letter code value;

Return: found standard raw array data, suitable to input three-letter code value (or null if not found).

#### Examples

[](#examples-1)

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getByAlpha3($rawStandardsData, 'ARM');
var_dump($result);

array(4) {
  ["name"]=>
  string(7) "Armenia"
  ["alpha2"]=>
  string(2) "AM"
  ["alpha3"]=>
  string(3) "ARM"
  ["numericCode"]=>
  string(3) "051"
}

$result = StandardSearchUtility::getByAlpha3($rawStandardsData, 'FOO');
var_dump($result);

NULL

$service = new StandardSearchUtilityService();

$result = $service->getByAlpha3($rawStandardsData, 'ARM');
var_dump($result);

array(4) {
  ["name"]=>
  string(7) "Armenia"
  ["alpha2"]=>
  string(2) "AM"
  ["alpha3"]=>
  string(3) "ARM"
  ["numericCode"]=>
  string(3) "051"
}

$result = $service->getByAlpha3($rawStandardsData, 'RUS');
var_dump($result);

NULL
```

### getByNumericCode

[](#getbynumericcode)

```
public static function getByNumericCode(
    array $standardsData,
    string $numericCode
): ?array;
```

```
public function getByNumericCode(
    array $standardsData,
    string $numericCode
): ?array;
```

Input:

- $standardsData - array standards raw dataset;
- $numericCode - numeric code value;

Return: found standard raw array data, suitable to input numeric code value (or null if not found).

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getByNumericCode($rawStandardsData, '051');
var_dump($result);

array(4) {
  ["name"]=>
  string(7) "Armenia"
  ["alpha2"]=>
  string(2) "AM"
  ["alpha3"]=>
  string(3) "ARM"
  ["numericCode"]=>
  string(3) "051"
}

$result = StandardSearchUtility::getByNumericCode($rawStandardsData, '000');
var_dump($result);

NULL

$service = new StandardSearchUtilityService();

$result = $service->getByNumericCode($rawStandardsData, '051');
var_dump($result);

array(4) {
  ["name"]=>
  string(7) "Armenia"
  ["alpha2"]=>
  string(2) "AM"
  ["alpha3"]=>
  string(3) "ARM"
  ["numericCode"]=>
  string(3) "051"
}

$result = $service->getByNumericCode($rawStandardsData, '000');
var_dump($result);

NULL
```

### getStandardsDataByAttributeCode

[](#getstandardsdatabyattributecode)

```
public static function getStandardsDataByAttributeCode(
    array $standardsData,
    string $attributeCode,
    string $value
): ?array;
```

```
public function getStandardsDataByAttributeCode(
    array $standardsData,
    string $attributeCode,
    string $value
): ?array;
```

Input:

- $standardsData - array standards raw dataset;
- $attributeCode - code attribute name;
- $value - code value

Return: found standard raw array data, suitable to input code attribute name and code value (or null if not found).

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getStandardsDataByAttributeCode($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, 'AU');
var_dump($result);

array(4) {
  ["name"]=>
  string(9) "Australia"
  ["alpha2"]=>
  string(2) "AU"
  ["alpha3"]=>
  string(3) "AUS"
  ["numericCode"]=>
  string(3) "036"
}

$result = StandardSearchUtility::getStandardsDataByAttributeCode($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, 'AUS');
var_dump($result);

NULL

$service = new StandardSearchUtilityService();

$result = $service->getStandardsDataByAttributeCode($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, 'AU');
var_dump($result);

array(4) {
  ["name"]=>
  string(9) "Australia"
  ["alpha2"]=>
  string(2) "AU"
  ["alpha3"]=>
  string(3) "AUS"
  ["numericCode"]=>
  string(3) "036"
}

$result = $service->getStandardsDataByAttributeCode($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, 'AUS');
var_dump($result);

NULL
```

### existByAlpha2

[](#existbyalpha2)

```
public static function existByAlpha2(
    array $standardsData,
    string $alpha2
): bool;
```

```
public function existByAlpha2(
    array $standardsData,
    string $alpha2
): bool;
```

Input:

- $standardsData - array standards raw dataset;
- $alpha2 - two-letter code value;

Return: true if standard raw data exist by two-letter code, false if not exist.

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::existByAlpha2($rawStandardsData, 'AU');
var_dump($result);

bool(true)

$result = StandardSearchUtility::existByAlpha2($rawStandardsData, 'AUS');
var_dump($result);

bool(false)

$service = new StandardSearchUtilityService();

$result = $service->existByAlpha2($rawStandardsData, 'AU');
var_dump($result);

bool(true)

$result = $service->existByAlpha2($rawStandardsData, 'AUS');
var_dump($result);

bool(false)
```

### existByAlpha3

[](#existbyalpha3)

```
public static function existByAlpha3(
    array $standardsData,
    string $alpha3
): bool;
```

```
public function existByAlpha3(
    array $standardsData,
    string $alpha3
): bool;
```

Input:

- $standardsData - array standards raw dataset;
- $alpha3 - three-letter code value;

Return: true if standard raw data exist by three-letter code, false if not exist.

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::existByAlpha3($rawStandardsData, 'AUS');
var_dump($result);

bool(true)

$result = StandardSearchUtility::existByAlpha3($rawStandardsData, 'AU');
var_dump($result);

bool(false)

$service = new StandardSearchUtilityService();

$result = $service->existByAlpha3($rawStandardsData, 'AUS');
var_dump($result);

bool(true)

$result = $service->existByAlpha3($rawStandardsData, 'AU');
var_dump($result);

bool(false)
```

### existByNumericCode

[](#existbynumericcode)

```
public static function existByNumericCode(
    array $standardsData,
    string $numericCode
): bool;
```

```
public function existByNumericCode(
    array $standardsData,
    string $numericCode
): bool;
```

Input:

- $standardsData - array standards raw dataset;
- $numericCode - numeric code value;

Return: true if standard raw data exist by numeric code, false if not exist.

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::existByNumericCode($rawStandardsData, '036');
var_dump($result);

bool(true)

$result = StandardSearchUtility::existByNumericCode($rawStandardsData, '000');
var_dump($result);

bool(false)

$service = new StandardSearchUtilityService();

$result = $service->existByNumericCode($rawStandardsData, '036');
var_dump($result);

bool(true)

$result = $service->existByNumericCode($rawStandardsData, '000');
var_dump($result);

bool(false)
```

### existByAttributeCode

[](#existbyattributecode)

```
public static function existByAttributeCode(
    array $standardsData,
    string $attributeCode,
    string $value
): bool;
```

```
public function existByAttributeCode(
    array $standardsData,
    string $attributeCode,
    string $value
): bool;
```

Input:

- $standardsData - array standards raw dataset;
- $attributeCode - code attribute name;
- $value - code value

Return: true if found standard raw array data exist, false if not exist.

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::existByAttributeCode($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, 'AU');
var_dump($result);

bool(true)

$result = StandardSearchUtility::existByAttributeCode($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, 'foo');
var_dump($result);

bool(false)

$service = new StandardSearchUtilityService();

$result = $service->existByAttributeCode($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, 'AU');
var_dump($result);

bool(true)

$result = $service->existByAttributeCode($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, 'foo');
var_dump($result);

bool(false)
```

### getAllNames

[](#getallnames)

```
public static function getAllNames(
    array $standardsData
): array;
```

```
public function getAllNames(
    array $standardsData
): array;
```

Input:

- $standardsData - array standards raw dataset;

Return: standards names string\[\].

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getAllNames($rawStandardsData);
var_dump($result);

array(3) {
  [0]=>
  string(7) "Armenia"
  [1]=>
  string(5) "Aruba"
  [2]=>
  string(9) "Australia"
}

$service = new StandardSearchUtilityService();

$result = $service->getAllNames($rawStandardsData);
var_dump($result);

array(3) {
  [0]=>
  string(7) "Armenia"
  [1]=>
  string(5) "Aruba"
  [2]=>
  string(9) "Australia"
}
```

### getAllNumericCodes

[](#getallnumericcodes)

```
public static function getAllNumericCodes(
    array $standardsData
): array;
```

```
public function getAllNumericCodes(
    array $standardsData
): array;
```

Input:

- $standardsData - array standards raw dataset;

Return: standards numeric codes string\[\].

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getAllNumericCodes($rawStandardsData);
var_dump($result);

array(3) {
  [0]=>
  string(3) "051"
  [1]=>
  string(3) "533"
  [2]=>
  string(3) "036"
}

$service = new StandardSearchUtilityService();

$result = $service->getAllNumericCodes($rawStandardsData);
var_dump($result);

array(3) {
  [0]=>
  string(3) "051"
  [1]=>
  string(3) "533"
  [2]=>
  string(3) "036"
}
```

### getAllAlpha3

[](#getallalpha3)

```
public static function getAllAlpha3(
    array $standardsData
): array;
```

```
public function getAllAlpha3(
    array $standardsData
): array;
```

Input:

- $standardsData - array standards raw dataset;

Return: standards Alpha3 codes string\[\].

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getAllAlpha3($rawStandardsData);
var_dump($result);

array(3) {
  [0]=>
  string(3) "ARM"
  [1]=>
  string(3) "ABW"
  [2]=>
  string(3) "AUS"
}

$service = new StandardSearchUtilityService();

$result = $service->getAllAlpha3($rawStandardsData);
var_dump($result);

array(3) {
  [0]=>
  string(3) "ARM"
  [1]=>
  string(3) "ABW"
  [2]=>
  string(3) "AUS"
}
```

### getAllAlpha2

[](#getallalpha2)

```
public static function getAllAlpha2(
    array $standardsData
): array;
```

```
public function getAllAlpha2(
    array $standardsData
): array;
```

Input:

- $standardsData - array standards raw dataset;

Return: standards Alpha2 codes string\[\].

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getAllAlpha2($rawStandardsData);
var_dump($result);

array(3) {
  [0]=>
  string(2) "AM"
  [1]=>
  string(2) "AW"
  [2]=>
  string(2) "AU"
}

$service = new StandardSearchUtilityService();

$result = $service->getAllAlpha2($rawStandardsData);
var_dump($result);

array(3) {
  [0]=>
  string(2) "AM"
  [1]=>
  string(2) "AW"
  [2]=>
  string(2) "AU"
}
```

### getAllAttributesByCode

[](#getallattributesbycode)

```
public static function getAllAttributesByCode(
    array $standardsData,
    string $attributeCode
): array;
```

```
public function getAllAttributesByCode(
    array $standardsData,
    string $attributeCode
): array
```

Input:

- $standardsData - array standards raw dataset;
- $attributeCode - code attribute name;

Return: standards attribute code value searched by attribute code name.

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getAllAttributesByCode($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2);
var_dump($result);

array(3) {
  [0]=>
  string(2) "AM"
  [1]=>
  string(2) "AW"
  [2]=>
  string(2) "AU"
}

$service = new StandardSearchUtilityService();

$result = $service->getAllAttributesByCode($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2);
var_dump($result);

array(3) {
  [0]=>
  string(2) "AM"
  [1]=>
  string(2) "AW"
  [2]=>
  string(2) "AU"
}
```

### getAllByAttributeCodeValues

[](#getallbyattributecodevalues)

```
public static function getAllByAttributeCodeValues(
    array $standardsData,
    string $attributeCode,
    array $values
): array;
```

```
public function getAllByAttributeCodeValues(
    array $standardsData,
    string $attributeCode,
    array $values
): array;
```

Input:

- $standardsData - array standards raw dataset;
- $attributeCode - code attribute name;
- $values - code values string array;

Return: array of standards, filtered by given code attribute name and code values string array.

#### Examples

[](#examples-2)

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getAllByAttributeCodeValues($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, ['AU', 'AM']);
var_dump($result);

array(2) {
  [0]=>
  array(4) {
    ["name"]=>
    string(7) "Armenia"
    ["alpha2"]=>
    string(2) "AM"
    ["alpha3"]=>
    string(3) "ARM"
    ["numericCode"]=>
    string(3) "051"
  }
  [1]=>
  array(4) {
    ["name"]=>
    string(9) "Australia"
    ["alpha2"]=>
    string(2) "AU"
    ["alpha3"]=>
    string(3) "AUS"
    ["numericCode"]=>
    string(3) "036"
  }
}

$result = StandardSearchUtility::getAllByAttributeCodeValues($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, ['AUS', 'ARM']);
var_dump($result);

array(0) {
}

$service = new StandardSearchUtilityService();

$result = $service->getAllByAttributeCodeValues($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, ['AU', 'AM']);
var_dump($result);

array(2) {
  [0]=>
  array(4) {
    ["name"]=>
    string(7) "Armenia"
    ["alpha2"]=>
    string(2) "AM"
    ["alpha3"]=>
    string(3) "ARM"
    ["numericCode"]=>
    string(3) "051"
  }
  [1]=>
  array(4) {
    ["name"]=>
    string(9) "Australia"
    ["alpha2"]=>
    string(2) "AU"
    ["alpha3"]=>
    string(3) "AUS"
    ["numericCode"]=>
    string(3) "036"
  }
}

$result = $service->getAllByAttributeCodeValues($rawStandardsData, AttributeCodes::ATTRIBUTE_ALPHA2, ['AUS', 'ARM']);
var_dump($result);

array(0) {
}
```

### getAllByAlpha2Values

[](#getallbyalpha2values)

```
public static function getAllByAlpha2Values(
    array $standardsData,
    array $values
): array;
```

```
public function getAllByAlpha2Values(
    array $standardsData,
    array $values
): array;
```

Input:

- $standardsData - array standards raw dataset;
- $values - alpha2 code values string array;

Return: array of standards, filtered by given alpha2 code values string array.

#### Examples

[](#examples-3)

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getAllByAlpha2Values($rawStandardsData, ['AU', 'AM']);
var_dump($result);

array(2) {
  [0]=>
  array(4) {
    ["name"]=>
    string(7) "Armenia"
    ["alpha2"]=>
    string(2) "AM"
    ["alpha3"]=>
    string(3) "ARM"
    ["numericCode"]=>
    string(3) "051"
  }
  [1]=>
  array(4) {
    ["name"]=>
    string(9) "Australia"
    ["alpha2"]=>
    string(2) "AU"
    ["alpha3"]=>
    string(3) "AUS"
    ["numericCode"]=>
    string(3) "036"
  }
}

$result = StandardSearchUtility::getAllByAlpha2Values($rawStandardsData, ['AUS', 'ARM']);
var_dump($result);

array(0) {
}

$service = new StandardSearchUtilityService();

$result = $service->getAllByAlpha2Values($rawStandardsData, ['AU', 'AM']);
var_dump($result);

array(2) {
  [0]=>
  array(4) {
    ["name"]=>
    string(7) "Armenia"
    ["alpha2"]=>
    string(2) "AM"
    ["alpha3"]=>
    string(3) "ARM"
    ["numericCode"]=>
    string(3) "051"
  }
  [1]=>
  array(4) {
    ["name"]=>
    string(9) "Australia"
    ["alpha2"]=>
    string(2) "AU"
    ["alpha3"]=>
    string(3) "AUS"
    ["numericCode"]=>
    string(3) "036"
  }
}

$result = $service->getAllByAlpha2Values($rawStandardsData, ['AUS', 'ARM']);
var_dump($result);

array(0) {
}
```

### getAllByAlpha3Values

[](#getallbyalpha3values)

```
public static function getAllByAlpha3Values(
    array $standardsData,
    array $values
): array;
```

```
public function getAllByAlpha3Values(
    array $standardsData,
    array $values
): array;
```

Input:

- $standardsData - array standards raw dataset;
- $values - alpha3 code values string array;

Return: array of standards, filtered by given alpha3 code values string array.

#### Examples

[](#examples-4)

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getAllByAlpha3Values($rawStandardsData, ['AUS', 'ARM']);
var_dump($result);

array(2) {
  [0]=>
  array(4) {
    ["name"]=>
    string(7) "Armenia"
    ["alpha2"]=>
    string(2) "AM"
    ["alpha3"]=>
    string(3) "ARM"
    ["numericCode"]=>
    string(3) "051"
  }
  [1]=>
  array(4) {
    ["name"]=>
    string(9) "Australia"
    ["alpha2"]=>
    string(2) "AU"
    ["alpha3"]=>
    string(3) "AUS"
    ["numericCode"]=>
    string(3) "036"
  }
}

$result = StandardSearchUtility::getAllByAlpha3Values($rawStandardsData, ['AU', 'AM']);
var_dump($result);

array(0) {
}

$service = new StandardSearchUtilityService();

$result = $service->getAllByAlpha3Values($rawStandardsData, ['AUS', 'ARM']);
var_dump($result);

array(2) {
  [0]=>
  array(4) {
    ["name"]=>
    string(7) "Armenia"
    ["alpha2"]=>
    string(2) "AM"
    ["alpha3"]=>
    string(3) "ARM"
    ["numericCode"]=>
    string(3) "051"
  }
  [1]=>
  array(4) {
    ["name"]=>
    string(9) "Australia"
    ["alpha2"]=>
    string(2) "AU"
    ["alpha3"]=>
    string(3) "AUS"
    ["numericCode"]=>
    string(3) "036"
  }
}

$result = $service->getAllByAlpha3Values($rawStandardsData, ['AU', 'AM']);
var_dump($result);

array(0) {
}
```

### getAllByNumericCodeValues

[](#getallbynumericcodevalues)

```
public static function getAllByNumericCodeValues(
    array $standardsData,
    array $values
): array;
```

```
public function getAllByNumericCodeValues(
    array $standardsData,
    array $values
): array;
```

Input:

- $standardsData - array standards raw dataset;
- $values - numeric code values string array;

Return: array of standards, filtered by given numeric code values string array.

#### Examples

[](#examples-5)

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getAllByNumericCodeValues($rawStandardsData, ['051', '036']);
var_dump($result);

array(2) {
  [0]=>
  array(4) {
    ["name"]=>
    string(7) "Armenia"
    ["alpha2"]=>
    string(2) "AM"
    ["alpha3"]=>
    string(3) "ARM"
    ["numericCode"]=>
    string(3) "051"
  }
  [1]=>
  array(4) {
    ["name"]=>
    string(9) "Australia"
    ["alpha2"]=>
    string(2) "AU"
    ["alpha3"]=>
    string(3) "AUS"
    ["numericCode"]=>
    string(3) "036"
  }
}

$result = StandardSearchUtility::getAllByNumericCodeValues($rawStandardsData, ['000', '111']);
var_dump($result);

array(0) {
}

$service = new StandardSearchUtilityService();

$result = $service->getAllByNumericCodeValues($rawStandardsData, ['051', '036']);
var_dump($result);

array(2) {
  [0]=>
  array(4) {
    ["name"]=>
    string(7) "Armenia"
    ["alpha2"]=>
    string(2) "AM"
    ["alpha3"]=>
    string(3) "ARM"
    ["numericCode"]=>
    string(3) "051"
  }
  [1]=>
  array(4) {
    ["name"]=>
    string(9) "Australia"
    ["alpha2"]=>
    string(2) "AU"
    ["alpha3"]=>
    string(3) "AUS"
    ["numericCode"]=>
    string(3) "036"
  }
}

$result = $service->getAllByNumericCodeValues($rawStandardsData, ['000', '111']);
var_dump($result);

array(0) {
}
```

### getAllByNameValues

[](#getallbynamevalues)

```
public static function getAllByNameValues(
    array $standardsData,
    array $values
): array;
```

```
public function getAllByNameValues(
    array $standardsData,
    array $values
): array;
```

Input:

- $standardsData - array standards raw dataset;
- $values - name values string array;

Return: array of standards, filtered by given name values string array.

#### Examples

[](#examples-6)

```
$rawStandardsData = [
    [
        AttributeCodes::ATTRIBUTE_NAME => "Armenia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AM",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ARM",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "051",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Aruba",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AW",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "ABW",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "533",
    ],
    [
        AttributeCodes::ATTRIBUTE_NAME => "Australia",
        AttributeCodes::ATTRIBUTE_ALPHA2 => "AU",
        AttributeCodes::ATTRIBUTE_ALPHA3 => "AUS",
        AttributeCodes::ATTRIBUTE_NUMERIC_CODE => "036",
    ],
];

$result = StandardSearchUtility::getAllByNameValues($rawStandardsData, ['Armenia', 'Australia']);
var_dump($result);

array(2) {
  [0]=>
  array(4) {
    ["name"]=>
    string(7) "Armenia"
    ["alpha2"]=>
    string(2) "AM"
    ["alpha3"]=>
    string(3) "ARM"
    ["numericCode"]=>
    string(3) "051"
  }
  [1]=>
  array(4) {
    ["name"]=>
    string(9) "Australia"
    ["alpha2"]=>
    string(2) "AU"
    ["alpha3"]=>
    string(3) "AUS"
    ["numericCode"]=>
    string(3) "036"
  }
}

$result = StandardSearchUtility::getAllByNameValues($rawStandardsData, ['foo', 'bar']);
var_dump($result);

array(0) {
}

$service = new StandardSearchUtilityService();

$result = $service->getAllByNameValues($rawStandardsData, ['Armenia', 'Australia']);
var_dump($result);

array(2) {
  [0]=>
  array(4) {
    ["name"]=>
    string(7) "Armenia"
    ["alpha2"]=>
    string(2) "AM"
    ["alpha3"]=>
    string(3) "ARM"
    ["numericCode"]=>
    string(3) "051"
  }
  [1]=>
  array(4) {
    ["name"]=>
    string(9) "Australia"
    ["alpha2"]=>
    string(2) "AU"
    ["alpha3"]=>
    string(3) "AUS"
    ["numericCode"]=>
    string(3) "036"
  }
}

$result = $service->getAllByNameValues($rawStandardsData, ['foo', 'bar']);
var_dump($result);

array(0) {
}
```

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

[](#contributing)

Welcome to pull requests. If there is a major changes, first please open an issue for discussion.

Please make sure to update tests as appropriate.

Code coverage information
-------------------------

[](#code-coverage-information)

Coverage information locates on top of README file.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.2% 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 ~171 days

Total

2

Last Release

1514d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/81402dcd0a07ad550b7f80f5871e7c302770b29d4c73a52fc35ba697f702d56e?d=identicon)[arslanim](/maintainers/arslanim)

---

Top Contributors

[![arslanim](https://avatars.githubusercontent.com/u/22678154?v=4)](https://github.com/arslanim "arslanim (287 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (62 commits)")

---

Tags

iso-standardiso-utilities

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/arslanimamutdinov-iso-standard-utilities/health.svg)

```
[![Health](https://phpackages.com/badges/arslanimamutdinov-iso-standard-utilities/health.svg)](https://phpackages.com/packages/arslanimamutdinov-iso-standard-utilities)
```

PHPackages © 2026

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