承接 exinone/laravel-mixin-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

exinone/laravel-mixin-sdk

Composer 安装命令:

composer require exinone/laravel-mixin-sdk

包简介

MixinNetwork SDK for Laravel

README 文档

README

MixinNetwork SDK for Laravel 5

Requirement

  1. Laravel >= 5.1
  2. Composer
  3. PHP >= 7.0

Installation

$ composer require exinone/laravel-mixin-sdk -vvv

Configuration

  1. Add the provider and facade in config/app.php, Laravel 5.5+ supports package discovery automatically, you should skip this step.

    'providers' => [
        ...
        ExinOne\MixinSDK\MixinSDKServiceProvider::class,
    ],
    'aliases' => [
        ...
        'MixinSDK' => ExinOne\MixinSDK\Facades\MixinSDK::class,
    ]
  2. Publish configuration

    $ php artisan vendor:publish --provider="ExinOne\MixinSDK\MixinSDKServiceProvider"
  3. You can configure it with any of methods below.

    1. Edit config/mixin-sdk.php and .env :

      // account information
      'keys'    => [
      // default use is config
          'default' => [
              'mixin_id'      => env('MIXIN_SDK_MIXIN_ID'),
              'client_id'     => env('MIXIN_SDK_CLIENT_ID'),
              'client_secret' => env('MIXIN_SDK_CLIENT_SECRET'),
              'pin'           => env('MIXIN_SDK_PIN'),
              'pin_token'     => env('MIXIN_SDK_PIN_TOKEN'),
              'session_id'    => env('MIXIN_SDK_SESSION_ID'),
              'private_key'   => str_replace("\\n", "\n", env('MIXIN_SDK_PRIVATE_KEY')),  //import your private_key
              'safe_key'      => env('MIXIN_SDK_SAFE_KEY'),
          ],
          'myConfig-A'=>[
              ...
          ]
      ],

      these configurations will be automatically loaded.

      // then you can
      MixinSDK::user()->readProfile();
      // or
      MixinSDK::use('myConfig-A')->user()->readProfile();

      If you don't want your private key stored in the VCS,refer to link

    2. else you can call it as follows:

      // use setConfig method to save config
      MixinSDK::setConfig('myConfig-A',$config0);
      MixinSDK::setConfig('myConfig-B',$config1);
      // then you can
      MixinSDK::use('myConfig-A')->user()->readProfile();
      
      //-------
      // Or more simple way, using the 'use' method , chained with other methods
      MixinSDK::use('myConfig-A',$config)->user()->readProfile();
      // then you can
      MixinSDK::use('myConfig-A')->user()->readProfile();
    3. You can also use your own way packing them up in your project to make it easy to switch configs.

Use

Run

code description module Mixin Network Docs
MixinSDK::pin()->updatePin($oldPin, $pin) Update Pin code Pin link
MixinSDK::pin()->verifyPin($pin) Verify Pin code Pin link
--- -- --
--- -- --
--- -- --
MixinSDK::user()->readProfile() Read self profile User link
MixinSDK::user()->updateProfile(string $full_name, string $avatar_base64 = '') Update user’s profile. User link
MixinSDK::user()->updatePreferences(string $receive_message_source, string $accept_conversation_source) Update user’s preferences. User link
MixinSDK::user()->rotateQRCode() Rotate user’s code_id. User link
MixinSDK::user()->readFriends() Get user’s friends. User link
--- -- --
--- -- --
--- -- --
MixinSDK::wallet()->createAddress(string $asset_id, string $public_key, $pin, $label, bool $isEOS = false) Create an address for withdrawal Wallet link
MixinSDK::wallet()->readAddresses(string $assetId) Read addresses by asset ID. Wallet link
MixinSDK::wallet()->readAddress(string $addressId) Read an address by ID. Wallet link
MixinSDK::wallet()->deleteAddress(string $addressId, $pin) Delete an address by ID. Wallet link
MixinSDK::wallet()->readAssets() Read user’s all assets. Wallet link
MixinSDK::wallet()->readAsset(string $assetId) Read asset by ID. Wallet link
MixinSDK::wallet()->deposit(string $assetId) Gant an asset’s deposit address (The api same as wallet()->readAsset) Wallet link
MixinSDK::wallet()->withdrawal(string $addressId, $amount, $pin, $memo = '', $tracd_id = null) Get assets out of Mixin Network Wallet link
MixinSDK::wallet()->transfer(string $assetId, string $opponentId, $pin, $amount, $memo = '', $tracd_id = null) Transfer of assets between Mixin Network users. Wallet link
MixinSDK::wallet()->verifyPayment(string $asset_id, string $opponent_id, $amount, string $trace_id) Verify a transfer Wallet link
MixinSDK::wallet()->readTransfer(string $traceId) Read transfer by trace ID. Wallet link
MixinSDK::wallet()->readAssetFee(string $assetId) Read transfer fee Wallet link
MixinSDK::wallet()->readUserSnapshots($limit = null, string $offset = null, string $asset = '', string $order = 'DESC') Get user's all snapshots. Wallet link
MixinSDK::wallet()->readUserSnapshot(string $snapshotId) Get user's a snapshots by ID. Wallet link
--- -- --
--- -- --
--- -- --
MixinSDK::network()->readUser( $userId) Get user’s information by ID. Network link
MixinSDK::network()->readUsers(array $userIds) Get users information by IDs. Network link
MixinSDK::network()->searchUser($item) Search user by ID. Network link
MixinSDK::network()->readNetworkAsset(string $assetId) Read public asset information by ID from Mixin Network. Network link
MixinSDK::network()->readNetworkSnapshots($limit = null, string $offset = null, string $asset = '', string $order = 'DESC') Read public snapshots of Mixin Network. Network link
MixinSDK::network()->readNetworkSnapshot(string $snapshotId) Read public snapshots of Mixin Network by ID. Network link
MixinSDK::network()->createUser($fullName) Create a new Mixin Network user Network link
MixinSDK::network()->externalTransactions($asset, $public_key, $limit, $offset, $account_name) Read external transactions Network link
MixinSDK::network()->createAttachments() Create an attachment upload address. Network link
MixinSDK::network()->mixinNetworkChainsSyncStatus() Get Mixin Network Chains Synchronize status Network
MixinSDK::network()->topAsset() top asset Network link
MixinSDK::network()->requestAccessToken(string $code) use code request access token Network link
MixinSDK::network()->accessTokenGetInfo(string $access_token) use access token get info Network link
MixinSDK::network()->accessTokenGetAssets(string $access_token) use access token get assets info Network link
MixinSDK::network()->accessTokenGetContacts(string $access_token) use access token get contact info Network link
MixinSDK::network()->searchAssets(string $snapshotId) search assets Network link
--- -- --
--- -- --
--- -- --
MixinSDK::message()->sendText($user_id, $data, $category , $conversation_id) send text Message link
MixinSDK::message()->sendContact($user_id, $contact_id, $category, $conversation_id) send user card Message link
MixinSDK::message()->sendAppButtonGroup($user_id, $data, $category, $conversation_id) send App Button Group (max three) Message link
MixinSDK::message()->sendAppCard($user_id, $data, $category, $conversation_id) send App Card Message link
MixinSDK::message()->askMessageReceipt($message_id) ask Message Receipt Message link
MixinSDK::message()->sendBatchMessage($user_id, $data, $category , $conversation_id) send batch message Message link
--- -- --
--- -- --
--- -- --
MixinSDK::getOauthUrl($client_id, string $scope) Get Oauth Url other link
MixinSDK::getPayUrl($asset_id, $amount, $trace_id, $memo, $client_id = null) generate a pay Url other link
MixinSDK::getConfig($configGroupName='') read config other

Exceptions

If MixinNetwork response with an error,An Exception ExinOne\MixinSDK\Exceptions\MixinNetworkRequestException will be thrown. Developers need to capture and handle this exception.

<?php
try {
    // If the transfer fails here, an error will be thrown.
    MixinSDK::wallet()->transfer($asset_id, $opponent_id, $pin, $amount, $memo);
} catch (MixinNetworkRequestException $e) {
    // Here errCode and errMessage are the same as MixinNetwork, refer to the following link.
    $errCode    = $e->getCode();
    $errMessage = $e->getMessage();
    ...
} catch (\Throwable $e) {
    ...
}

MixinNetwork Error Codes

Other Exceptions

class description
ExinOne\MixinSDK\Exceptions\MixinNetworkRequestException Api request fail
ExinOne\MixinSDK\Exceptions\NotFoundConfigException not found config set
ExinOne\MixinSDK\Exceptions\LoadPrivateKeyException private Key error
ExinOne\MixinSDK\Exceptions\ClassNotFoundException class not found

WARNING

  1. You can config iterator in the following way. The iterator is used when a PIN is encrypted. Generally, iterator should not be modified. If you want ot modify this variable, be sure to know what you are doing. More details on iterator

    <?php
    $iterator = [time()];
    // if use it by MixinSDK::pin()->updatePin($oldPin,$pin),
    // $iterator need have two element (count($iterator) == 2)
    
    MixinSDK::wallet()->setIterator($iterator)->transfer($asset_id, $opponent_id, $pin, $amount, $memo);
    // By default, microtime(true) * 100000 is used as iterator
  2. Get raw Recponse content

    <?php
    $mixinSdk->wallet()->setRaw(true)->transfer($asset_id, $opponent_id, $pin, $amount, $memo);
    // Return MixinNetwork raw Response content

Alternatives

[exinone/mixin-sdk-php]

[zamseam/mixin]

LICENSE

MIT

exinone/laravel-mixin-sdk 适用场景与选型建议

exinone/laravel-mixin-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.99k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2018 年 12 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 exinone/laravel-mixin-sdk 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 6
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-04