定制 tfasoft/sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tfasoft/sdk

Composer 安装命令:

composer require tfasoft/sdk

包简介

Telegram Factor Authentication PHP library

README 文档

README

PHP SDK document is in docs.tfasoft.com

If you are using TFA as your authentication service in your PHP applications, you can use our library.

How to use the library

So, let's have a quick review of our steps.

Installation

You can install this as a composer package:

$ composer install tfasoft/sdk;

Configuration

Usage:

<?php

// ...

require_once __DIR__ . '/vendor/autoload.php';

// ...

use TFASoft\TFA;

// ...

$tfa = new TFA("<access-token>"); // you can use $tfa->getAccessToken() to get the value you've set here

$result = $tfa->authUser('<user-token>');

// ...

The $result will be an array with two status and data keys. $result["status"] will be the status code. And go to the next part to see structure of $result["data"];

Also you can change the base URL of the API:

$tfa = new TFA("<access-token>", 'http://base-url/of/api/');

// ...

$tfa->getBaseUrl(); // http://base-url/of/api/

Output structure

Here let's know about them in deep (possible results in $result['data']).

  • 200

{
    "user": {
        "_id": "document id",
        "uid": "telegram user id",
        "token": "one time token. Every time become null",
        "createdAt": "when created",
        "updatedAt": "last update",
        "__v": 0
    }
}
  • 401

One is access token is wrong.

{
    "message": "User authentication token is not valid"
}

Another is when user token is wrong.

{
    "message": "Admin access token is not valid"
}

Development

If you want to contribute or change the code:

  • Clone the project
  • Install dependencies by running $ composer install
  • Start changing!

To test your changes, you can create a .env file in root directory of project:

TEST_ACCESS_TOKEN="<access-token>"
TEST_USER_TOKEN="<user-token>"

and then run $ composer test.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固