PHP FunPay SMS Parser

ak-php-funpay-sms-parser

Releases Build Status StyleCI License

Introduction

PHP FunPay SMS Parser library allows to parse SMS messages from transaction confirmation gateway.

Contents

Installation

Install as package

Pull in the package through Composer in your application:

$ composer install antonkomarev/php-funpay-sms-parser

Standalone

Clone or download project from PHP FunPay SMS Parser git repository.

$ git clone git@github.com:antonkomarev/php-funpay-sms-parser.git && cd ./php-funpay-sms-parser

Generate class autoload file and install PHPUnit.

$ composer install

Demo

Demo script could be executed using PHP CLI:

$ php public/demo.php

You could experiment with $message variable value.

More examples could be found in tests/ParserTest.php file.

Usage

Instantiate Parser

$message = '
    Пароль: 0823
    Спишется 100,85р.
    Перевод на счет 410017080996934
';

$parsedMessage = new \AK\FunPay\SmsParser\Parser($message);

Available Methods

Get Yandex.Money account number

$parsedMessage->account(): string

Get transaction money amount

$parsedMessage->moneyAmount(): float

Get confirmation pin-code

$parsedMessage->pin(): string

Exceptions

  • ParserException (abstract)
  • MoneyAmountNotFound
  • PinNotFound
  • YandexAccountNotFound
  • YandexAccountInvalid

Testing

Run the tests with:

$ vendor/bin/phpunit

Author

@antonkomarev
Anton Komarev

License

  • PHP FunPay SMS Parser package is open-sourced software licensed under the MIT license by Anton Komarev.
  • Decomposition image licensed under Creative Commons 3.0 by Arthur Shlain.

Made by Jason, Chris and Shawn

© 2020 Builtneat, Inc. All rights reserved.