Skip to content

Commit

Permalink
Refactor gitignore and gitattributes, update
Browse files Browse the repository at this point in the history
version and add documentation
  • Loading branch information
alphaolomi committed Nov 15, 2023
1 parent 719df95 commit ad3eb1b
Show file tree
Hide file tree
Showing 15 changed files with 1,243 additions and 1,659 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
/.php-cs-fixer.dist.php export-ignore
/art export-ignore
/docs export-ignore
/ UPGRADING.md export -ignore
/ UPGRADING.md export-ignore
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: alphaolomi
37 changes: 37 additions & 0 deletions .github/workflows/run-phpunit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.1]
stability: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit
14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
/vendor/
/.idea/
.idea
.php_cs
.php_cs.cache
.phpunit.result.cache
build
composer.lock
coverage
docs
phpunit.xml
psalm.xml
vendor
.php-cs-fixer.cache
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

All notable changes to `alphalomi/mrz` will be documented in this file.

### Unreleased

- Update README.md
- Add `MrzParser` class
- Update
- Skip Accent Dialectic characters tests
- Add Testing GH Action
- Add FUNDING.yml

### 1.0.1 - 2023-11-13

- Fix use of deprecated `utf8_decode` function


### 1.0.0 - 2023-11-13

- initial release
61 changes: 57 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MRZ for PHP
# [MRZ]() for PHP

Machine Readable Zone for PHP, originally based on [mrz](https://github.com/MrEko/mrz)

Expand All @@ -12,23 +12,76 @@ composer require alphaolomi/mrz

## Usage

### Writing

``` php
use Alphaolomi\Mrz\Mrz;

$mrz = new Mrz("I", "Tanzania", "D23148958907", date("dmy",strtotime("1999-10-14")), "M", date("dmy",strtotime("2030-12-31")), "TZA", "OLOMI", "ALPHA");

echo $mrz->TD1CodeGenerator();
```

### Reading

``` php
use Alphaolomi\Mrz\MrzParser;

$mrzParser = new MrzParser();

$mrzOcrString = 'PTUNKKONI<<MARTINA<<<<<<<<<<<<<<<<<<<<<<<<<<K0503499<8UNK9701241F06022201170650553<<<<10';
$mrzData = $mrzParser->parse($mrzOcrString);
print(json_encode($mrzData, JSON_PRETTY_PRINT));
```
#### Reading Formats Supported
1. TD1
```
I<UTOD231458907<<<<<<<<<<<<<<<
7408122F1204159UTO<<<<<<<<<<<6
ERIKSSON<<ANNA<MARIA<<<<<<<<<<
```
1. TD2
```
I<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
D231458907UTO7408122F1204159<<<<<<<6
```
1. TD3
```
P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<14
```
1. MRV
```
V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L8988901C4XXX4009078F96121096ZE184226B<<<<<<
```
## Testing
Unit tests are written with [PHPUnit](https://phpunit.de/).
``` bash
composer test
```
## Credits
- [Evandro Kondrat][https://github.com/MrEko] Original Author
- [Alpha Olomi][https://github.com/alphaolomi]
- [All Contributors][link-contributors]
- [Evandro Kondrat](https://github.com/MrEko) Original Author
- [Alpha Olomi](https://github.com/alphaolomi)
- [Nascent Michael](https://github.com/nascent1)
- [All Contributors](../../contributors)
## License
Expand Down
15 changes: 7 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
"name": "alphaolomi/mrz",
"type": "library",
"description": "Machine Readable Zone SDK for PHP",
"keywords": ["mrz"],
"keywords": ["mrz"],
"license": "MIT",
"authors": [
{
"name": "Evandro Kondrat",
"email": "evandrok@gmail.com",
"homepage": "https://github.com/mreko",
"role": "Author"
},
{
"name": "Alpha Olomi",
"email": "alphaolomi@gmail.com",
"homepage": "https://github.com/alphaolomi",
"role": "Maintainer"
},
{
"name": "Nascent Michael",
"homepage": "https://github.com/nascent1",
"role": "Author"
}
],
"require": {
Expand All @@ -35,7 +34,7 @@
}
},
"scripts": {
"test": "phpunit tests"
"test": "./vendor/bin/phpunit"
},
"extra": {
"branch-alias": {
Expand Down
Loading

0 comments on commit ad3eb1b

Please sign in to comment.