定制 bitinflow/accounts 二次开发

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

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

bitinflow/accounts

Composer 安装命令:

composer require bitinflow/accounts

包简介

PHP bitinflow Accounts API Client for Laravel 5+

README 文档

README

Total Downloads Latest Stable Version License Discord

PHP bitinflow Accounts API Client for Laravel 5+

Table of contents

  1. Installation
  2. Event Listener
  3. Configuration
  4. Examples
  5. Documentation
  6. Development

Installation

composer require ghostzero/bitinflow-accounts

If you use Laravel 5.5+ you are already done, otherwise continue.

Add Service Provider to your app.php configuration file:

Bitinflow\Accounts\Providers\BitinflowAccountsServiceProvider::class,

Event Listener

  • Add SocialiteProviders\Manager\SocialiteWasCalled event to your listen[] array in app/Providers/EventServiceProvider.
  • Add your listeners (i.e. the ones from the providers) to the SocialiteProviders\Manager\SocialiteWasCalled[] that you just created.
  • The listener that you add for this provider is 'GhostZero\\BitinflowAccounts\\Socialite\\BitinflowExtendSocialite@handle',.
  • Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers.
/**
 * The event handler mappings for the application.
 *
 * @var array
 */
protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // add your listeners (aka providers) here
        'Bitinflow\\Accounts\\Socialite\\BitinflowExtendSocialite@handle',
    ],
];

Configuration

Copy configuration to config folder:

$ php artisan vendor:publish --provider="Bitinflow\Accounts\Providers\BitinflowAccountsServiceProvider"

Add environmental variables to your .env

BITINFLOW_ACCOUNTS_KEY=
BITINFLOW_ACCOUNTS_SECRET=
BITINFLOW_ACCOUNTS_REDIRECT_URI=http://localhost

You will need to add an entry to the services configuration file so that after config files are cached for usage in production environment (Laravel command artisan config:cache) all config is still available.

Add to config/services.php:

'bitinflow-accounts' => [
    'client_id' => env('BITINFLOW_ACCOUNTS_KEY'),
    'client_secret' => env('BITINFLOW_ACCOUNTS_SECRET'),
    'redirect' => env('BITINFLOW_ACCOUNTS_REDIRECT_URI')
],

Examples

Basic

$bitinflowAccounts = new Bitinflow\Accounts\BitinflowAccounts();

$bitinflowAccounts->setClientId('abc123');

// Get SSH Key by User ID
$result = $bitinflowAccounts->getSshKeysByUserId(38);

// Check, if the query was successfull
if ( ! $result->success()) {
    die('Ooops: ' . $result->error());
}

// Shift result to get single key data
$sshKey = $result->shift();

echo $sshKey->name;

Setters

$bitinflowAccounts = new Bitinflow\Accounts\BitinflowAccounts();

$bitinflowAccounts->setClientId('abc123');
$bitinflowAccounts->setClientSecret('abc456');
$bitinflowAccounts->setToken('abcdef123456');

$bitinflowAccounts = $bitinflowAccounts->withClientId('abc123');
$bitinflowAccounts = $bitinflowAccounts->withClientSecret('abc123');
$bitinflowAccounts = $bitinflowAccounts->withToken('abcdef123456');

OAuth Tokens

$bitinflowAccounts = new Bitinflow\Accounts\BitinflowAccounts();

$bitinflowAccounts->setClientId('abc123');
$bitinflowAccounts->setToken('abcdef123456');

$result = $bitinflowAccounts->getAuthedUser();

$user = $userResult->shift();
$bitinflowAccounts->setToken('uvwxyz456789');

$result = $bitinflowAccounts->getAuthedUser();
$result = $bitinflowAccounts->withToken('uvwxyz456789')->getAuthedUser();

Facade

use Bitinflow\Accounts\Facades\BitinflowAccounts;

BitinflowAccounts::withClientId('abc123')->withToken('abcdef123456')->getAuthedUser();

Documentation

Oauth

public function retrievingToken(string $grantType, array $attributes)

PaymentIntents

public function getPaymentIntent(string $id)
public function createPaymentIntent(array $parameters)

SshKeys

public function getSshKeysByUserId(int $id)
public function createSshKey(string $publicKey, string $name = NULL)
public function deleteSshKey(int $id)

Users

public function getAuthedUser()
public function createUser(array $parameters)

OAuth Scopes Enums

Development

Run Tests

composer test
BASE_URL=xxxx CLIENT_ID=xxxx CLIENT_KEY=yyyy CLIENT_ACCESS_TOKEN=zzzz composer test

Generate Documentation

composer docs

Join the bitinflow Discord!

Discord

bitinflow/accounts 适用场景与选型建议

bitinflow/accounts 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.14k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 05 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 bitinflow/accounts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bitinflow/accounts 我们能提供哪些服务?
定制开发 / 二次开发

基于 bitinflow/accounts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-14