Giter Site home page Giter Site logo

myckhel / laravel-checkmobi Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 3.0 54 KB

APIs to integrate mobile phone number verification via SMS, Voice Call & Missed Call on iOS, Android and the Web. Perfect for OTP one time password auth.

Home Page: https://checkmobi.com

License: MIT License

PHP 100.00%
checkmobi checkmobi-secret-key phone-number-verification verify missed-call sms-api

laravel-checkmobi's Introduction

CheckMobi

Latest Version on Packagist Software License Tests Status Total Downloads

Install

Via Composer $ composer require myckhel/checkmobi

Setup

The package will automatically register a service provider.

You need to publish the configuration file:

php artisan vendor:publish --provider="Myckhel\CheckMobi\CheckMobiServiceProvider"

This is the default content of the config file checkmobi.php:

<?php

return [
  "secret_key"          => env("CHECKMOBI_SECRET_KEY"),
  "retry_after"         => 120, // option to set the retry limit for each phone number verification
    /* coming soon */
  "route_middleware"    => 'auth:api', // For injecting middleware to the package's routes
];

Update Your Projects .env with:

CHECKMOBI_SECRET_KEY=XXXXXXXXXXXXXXXXXXXX

Run the database migration php artisan migrate

Available Api's

use CheckMobi;
use Myckhel\CheckMobi\Support\MissedCall;

CheckMobi::requestValidation($params);

CheckMobi::verifyValidation($params);

CheckMobi::getAccountDetails($params);

CheckMobi::getCountriesList($params);

CheckMobi::getPrefixes($params);

CheckMobi::checkNumber($params);

CheckMobi::validationStatus($validationId, $params);

CheckMobi::sendSMS($params);

CheckMobi::getSmsDetails($params);

CheckMobi::placeCall($params);

CheckMobi::getCallDetails($callId, $params);

CheckMobi::hangUpCall($callId, $params);

MissedCall::request($params);

MissedCall::verify($params);

API Usage Example

MissedCall

use Myckhel\CheckMobi\Support\MissedCall;
use CheckMobi;

class VerificationController {

  public function request(){

    return MissedCall::request([
        'number'                  => '+1 234 567 890', // E. 164 format
        'platform'                => 'web',
    ]);
  }

  public function verify(){

    return MissedCall::verify([
        'id'    => 'SMS-FF9137C1-4D39-42B0-BE86-4B5A96CE13BD', // E. 164 format
        'pin'   => '9711',
    ]);
  }

  public function exampleCheckMobi(){

    $validationResponse = CheckMobi::requestValidation([
          'number'                  => '+1 234 567 890', // E. 164 format
          'type'                    => 'reverse_cli',
          'platform'                => 'web',
    ]);

    $verificationResponse = CheckMobi::verifyValidation([
      "id": "SMS-FF9137C1-4D39-42B0-BE86-4B5A96CE13BD", // $validationResponse->id
      "pin":"9711"
    ]);
  }
}

Response Example

Request

{
  "id": "RCL-B772A954-7E63-4114-8087-BAF415B5003F",
  "type": "reverse_cli",
  "pin_hash": "6f8246002c1c5967ffc5e0ec80f2d7b59a60b1e3",
  "validation_info": {
      "country_code": 40,
      "country_iso_code": "RO",
      "carrier": "Orange",
      "is_mobile": true,
      "e164_format": "+40743XXXXXX",
      "formatting": "+40 743 XXX XXX"
  }
}

Verify

{
    "number":"+40XXXXXXXXX",
    "validated":true,
    "validation_date":1416946931,
    "charged_amount": 0.1
}

Todos

  • coming soon

Testing

Run the tests with:

vendor/bin/phpunit

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

License

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

laravel-checkmobi's People

Contributors

myckhel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.