承接 e-yakubov/branchio 相关项目开发

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

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

e-yakubov/branchio

Composer 安装命令:

composer require e-yakubov/branchio

包简介

Branch Metrics (Branch.io) HTTP API client

README 文档

README

This is just a simple HTTP client for the Branch Metrics API (Branch.io). At the moment it supports creating, updating and configuring Branch links. A future version will include retrieving data from existing links.

Codacy Maintainability Packagist License Version

Table of Contents

Important Notice

The latest versions after 1.1.x are not backwards compatible with the old versions 1.0.x.

Be careful when updating! If you want to upgrade to versions 1.1.x, please first follow the documentation to make the needed changes in your code

Installation

The package can be installed with Composer. Just run this command:

$ composer require iivannov/branchio

Basic usage

Get link data

$client = new \Iivannov\Branchio\Client(KEY, SECRET);
$link = $client->getLink($url);

Create new link


$link = new \Iivannov\Branchio\Link();
 
$link->setChannel('foo')
    ->setAlias('foobar123')
    ->setData([
        '$always_deeplink' => 'true',
        '$deeplink_path' => 'go-to-user-123'
        'user_id' => 123
    ]);
    
$client = new \Iivannov\Branchio\Client(KEY, SECRET);
$client->createLink($link);

Advanced Usage

Configure link instance

Link instance contains all the configurable options for a Branch Metrics link and provides method to set them.

$link = new \Iivannov\Branchio\Link();
 
// Set parameters separately
$link->setChannel('Channel name');
$link->setAlias('foobar123);
$link->setTags(['foo', 'bar']);

 
// It's possible to chain the set methods
$link->setChannel('Channel name')
    ->setAlias('foobar123')
    ->setTags(['foo', 'bar']);
    

Analytical Data

For full reference about the analytical options available please see: https://docs.branch.io/pages/links/integrate/#analytical-labels

Key Usage
channel Use channel to tag the route that your link reaches users. For example, tag links with 'Facebook' or 'LinkedIn' to help track clicks and installs through those paths separately
feature This is the feature of your app that the link might be associated with. For example, if you had built a referral program, you would label links with the feature 'referral'
campaign Use this field to organize the links by actual campaign. For example, if you launched a new feature or product and want to run a campaign around that
stage Use this to categorize the progress or category of a user when the link was generated. For example, if you had an invite system accessible on level 1, level 3 and 5, you could differentiate links generated at each level with this parameter
tags This is a free form entry with unlimited values ['string']. Use it to organize your link data with labels that don't fit within the bounds of the above
alias Specify a link alias to replace of the standard encoded short URL. Link aliases must be unique (a 409 error will occur if you create an alias already taken). Appending a / will break the alias. bnc.lt link domain alias links are incompatible with Universal Links and Spotlight.
type Must be an int. Set to 1 to limit deep link to a single use. Set to 2 to make the link show up under Quick Links while adding $marketing_title to data. Does not work with the Native SDKs
$link->setChannel('Channel name');
 
$link->setFeature('Feature name');
 
$link->setCampaign('Campaign name');
 
$link->setStage('Stage name');
 
$link->setTags(['foo', 'bar']);
 
$link->setAlias('foobar123);
 
$link->setType(UrlType::ONCE);    

Configure Link type

You can easily set the deep linking behaviour by passing the type parameter. You have the following options:

UrlType::DEFAULT_TYPE - default value,

UrlType::ONCE - to limit deep linking behavior of the generated link to a single use,

UrlType::MARKETING_TYPE - to make the link show up under Marketing page in the dashboard

$link->setType(UrlType::MARKETING);

Configure custom data

For full description of possible $data options, please see: https://docs.branch.io/pages/links/integrate/#redirections

$data = [
     '$always_deeplink' => true,
     '$deeplink_path' => 'open?action_id=1234',
     
     '$ios_url' => 'http://MyAppURL.com/ios',
     '$ipad_url' => 'http://MyAppURL.com/ipad',
     '$android_url' => 'http://MyAppURL.com/android',
     
     '$og_app_id' => '1234',
     '$og_title' => 'My App',
     '$og_description' => 'My app\'s description.',
     '$og_image_url' => 'http://MyAppURL.com/image.png',
     
     'mydata' => 'something',
     'foo' => 'bar',
];
 
$link->setData($data);

Create link

To create the configured link, just call the createLink method and pass the Link' instance

$client = new \Iivannov\Branchio\Client(KEY, SECRET);
$client->createLink($link);

Update link

To update an already existing link you need to pass the url of the link and the updated Link instance to the updateLink method

$client = new \Iivannov\Branchio\Client(KEY, SECRET);
$link = $client->getLink($url);
$link->setChannel('bar');
$client->updateLink($url, $link);

Usage with Laravel

If you are using Laravel, the package contains a Service Provider and a Facade for you.

  1. First you need to add the ServiceProvider and Facade classes in your config\app.php
'providers' => [
    ...
    Iivannov\Branchio\Integration\Laravel\BranchioServiceProvider::class,
];

'aliases' => [
    ...
    'Branchio' => Iivannov\Branchio\Integration\Laravel\Facade\Branchio::class
];
  1. Then you need to add your username and password in config\services.php
'branchio' => [
    'key' => YOUR_BRANCHIO_KEY,
    'secret' => YOUR_BRANCHIO_SECRET
]
  1. You are ready to go, just use the facade:
Branchio::getLink($url)
Branchio::createLink($link')
Branchio::updateLink($url, $link)

License

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

e-yakubov/branchio 适用场景与选型建议

e-yakubov/branchio 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.16k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 04 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「http」 「client」 「branch」 「branch.io」 「http api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 e-yakubov/branchio 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-07