repat / ham-radio
Amateur Radio Call Signs Verification
0.1
2019-08-31 04:12 UTC
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^6.3
- repat/http-constants: ^0.1
This package is auto-updated.
Last update: 2024-11-05 11:50:00 UTC
README
ham-radio is a library for quickly validating the format of a call sign by the rules of the country and also run a check against the official public database, e.g. by the FCC in the US.
Installation
$ composer require repat/ham-radio
Example
$us = new US; $us->verifyCallSign('KN6DZC'); // returns: [ // "Response" => [ // "Licenses" => [ // "License" => [ // "licName" => "...." $us ->validateCallSign('KN6DZC'); // returns: true
Supported Countries
- US
Contribute
- Fork the project
- Create a new class that
extends Helper
- Name the class after the ISO3166 country code
- Add a function
regex() : string
that returns a regular expression to validate the call sign format. - Add a function
verifyCallSign(string $callSign) : array
. With$this->client
you get aGuzzleHttp
client for making API calls. I also pulled inrepat/http-constants
for checking HTTP status codes in the response. In case the API returns XML, check out$this->xml2array()
. A json response could be returned byjson_decode($response, true)
.
License
- MIT, see LICENSE
Version
- Version 0.1
Contact
repat
- Homepage: https://repat.de
- e-mail: repat@repat.de
- Twitter: @repat123
- KN6DZC