PHPackages                             e-yakubov/branchio - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. e-yakubov/branchio

ActiveLibrary[HTTP &amp; Networking](/categories/http)

e-yakubov/branchio
==================

Branch Metrics (Branch.io) HTTP API client

1.1.3(5y ago)07.2kMITPHPPHP &gt;=5.6.0

Since Apr 11Pushed 5y agoCompare

[ Source](https://github.com/e-yakubov/branchio)[ Packagist](https://packagist.org/packages/e-yakubov/branchio)[ RSS](/packages/e-yakubov-branchio/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (2)Versions (8)Used By (0)

Branch Metrics (Branch.io) HTTP API Client
==========================================

[](#branch-metrics-branchio-http-api-client)

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](https://camo.githubusercontent.com/2027026458124777818bdcf43bd0c0cad61b2859d3fd659e2668095a8698d49c/68747470733a2f2f696d672e736869656c64732e696f2f636f646163792f67726164652f38383166346366333030383334613839626336656261316562353164393366332e737667)](https://www.codacy.com/app/iivannov/branchio) [![Maintainability](https://camo.githubusercontent.com/5acba16bd2faf0ec0a6f2a03eed002799c2f597066ca957e6f72978014c4ca20/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39343265346235656235643337663962643036312f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/iivannov/branchio/maintainability) [![Packagist](https://camo.githubusercontent.com/ca8101b6f55bbcae65a23833c93c1a195cc85b7b3a552a05974abd89857b4eb5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696976616e6e6f762f6272616e6368696f2e737667)](https://packagist.org/packages/iivannov/branchio) [![License](https://camo.githubusercontent.com/e41cf6f3b47a9b31b7b80da6cd7fb65360d705503bf8d70dd6e6a2d03c725a42/68747470733a2f2f706f7365722e707567782e6f72672f696976616e6e6f762f6272616e6368696f2f6c6963656e7365)](license.md) [![Version](https://camo.githubusercontent.com/835fc25a9b45087dac47700b1c21dc961efb7adc6f326bbd0475e0b7335de15d/68747470733a2f2f706f7365722e707567782e6f72672f696976616e6e6f762f6272616e6368696f2f762f737461626c65)](https://packagist.org/packages/iivannov/branchio)

---

***Table of Contents***

- [Important Notice](#important-notice)
- [Installation](#installation)
- [Basic usage](#basic-usage)
    - [Get link data](#get-link-data)
    - [Create new link](#create-new-link)
- [Advanced Usage](#advanced-usage)
    - [Configure link instance](#configure-link-instance)
    - [Analytical Data](#analytical-data)
    - [Configure Link type](#configure-link-type)
    - [Configure custom data](#configure-custom-data)
    - [Create link](#create-link)
    - [Update link](#update-link)
- [Usage with Laravel](#usage-with-laravel)
- [License](#license)

Important Notice
----------------

[](#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
------------

[](#installation)

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

```
$ composer require iivannov/branchio
```

Basic usage
-----------

[](#basic-usage)

### Get link data

[](#get-link-data)

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

### Create new link

[](#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
--------------

[](#advanced-usage)

### Configure link instance

[](#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

[](#analytical-data)

For full reference about the analytical options available please see:

KeyUsagechannelUse 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 separatelyfeatureThis 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'campaignUse 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 thatstageUse 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 parametertagsThis 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 abovealiasSpecify 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.typeMust 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

[](#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

[](#configure-custom-data)

For full description of possible `$data` options, please see:

```
$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

[](#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

[](#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
------------------

[](#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
];

```

2. Then you need to add your username and password in `config\services.php`

```
'branchio' => [
    'key' => YOUR_BRANCHIO_KEY,
    'secret' => YOUR_BRANCHIO_SECRET
]

```

3. You are ready to go, just use the facade:

```
Branchio::getLink($url)
Branchio::createLink($link')
Branchio::updateLink($url, $link)

```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](license.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~242 days

Recently: every ~321 days

Total

7

Last Release

1861d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/78569013?v=4)[lover157](/maintainers/lover157)[@lover157](https://github.com/lover157)

---

Top Contributors

[![ethanpooley](https://avatars.githubusercontent.com/u/856884?v=4)](https://github.com/ethanpooley "ethanpooley (3 commits)")[![e-yakubov](https://avatars.githubusercontent.com/u/5730844?v=4)](https://github.com/e-yakubov "e-yakubov (2 commits)")[![iivannov](https://avatars.githubusercontent.com/u/7932620?v=4)](https://github.com/iivannov "iivannov (1 commits)")[![samy](https://avatars.githubusercontent.com/u/1282106?v=4)](https://github.com/samy "samy (1 commits)")

---

Tags

httpphpclientbranchbranch.iohttp apibranch iobranch metrics

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/e-yakubov-branchio/health.svg)

```
[![Health](https://phpackages.com/badges/e-yakubov-branchio/health.svg)](https://phpackages.com/packages/e-yakubov-branchio)
```

###  Alternatives

[iivannov/branchio

Branch Metrics (Branch.io) HTTP API client

1682.2k](/packages/iivannov-branchio)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
