PHPackages                             byteark/byteark-sdk-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. byteark/byteark-sdk-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

byteark/byteark-sdk-php
=======================

ByteArk SDK for PHP

v0.2.0(5y ago)128.1k↓52.5%MITPHPPHP &gt;=5.4CI failing

Since Apr 19Pushed 6mo ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (13)Used By (0)

ByteArk SDK for PHP
===================

[](#byteark-sdk-for-php)

[![Packagist Version](https://camo.githubusercontent.com/be6a94cad7cdf7c68f1b1ffb54a106c55b13a82839a652ad8f033c54e67494d2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6279746561726b2f6279746561726b2d73646b2d7068702e7376673f7374796c653d666c6174)](https://packagist.org/packages/byteark/byteark-sdk-php)[![Build Status](https://camo.githubusercontent.com/699df57d3b6b4ac40ba569e8bf1f7024f67154ac7c88a0602a4016273806ae9c/68747470733a2f2f7472617669732d63692e6f72672f6279746561726b2f6279746561726b2d73646b2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/byteark/byteark-sdk-php)

- [Installation](#installation)
- [Using ByteArkV2UrlSigner class](#using-byteArkv2urlsigner-class)
- [Usage for HLS](#usage-for-hls)
- [Options](#options)
- [Using RequestInfo class](#using-requestinfo-class)
- [Example Projects](#example-projects)

Installation
------------

[](#installation)

You may install this SDK via [Composer](https://getcomposer.org)

```
composer require byteark/byteark-sdk-php

```

Using ByteArkV2UrlSigner class
------------------------------

[](#using-bytearkv2urlsigner-class)

First, create a ByteArkV2UrlSigner instance with `access_id` and `access_secret`. (`access_id` is currently optional for ByteArk Fleet).

Then, call `sign` method with URL to sign, Unix timestamp that the URL should expired, and sign options.

For sign options argument, you may include `method`, which determines which HTTP method is allowed (`GET` is the default is not determined), and may includes custom policies that appears in [ByteArk Documentation](https://docs.byteark.com/article/secure-url-signature-v2/).

The following example will create a signed URL that allows to `GET` the resource within 1st January 2018:

```
$signer = new \ByteArk\Signer\ByteArkV2UrlSigner([
    'access_id' => '',
    'access_secret' => '',
]);

$signedUrl = $signer->sign(
    'https://example.cdn.byteark.com/path/to/file.png',
    1514764800,
    [
        'method' => 'GET',
    ]
);

/*
Output:
https://example.cdn.byteark.com/path/to/file.png
    ?x_ark_access_id=2Aj6Wkge4hi1ZYLp0DBG
    &x_ark_auth_type=ark-v2
    &x_ark_expires=1514764800
    &x_ark_signature=OsBgZpn9LTAJowa0UUhlYQ
*/
```

Usage for HLS
-------------

[](#usage-for-hls)

When signing URL for HLS, you have to choose common path prefix and assign to `path_prefix` option is required, since ByteArk will automatically create secured URLs for each segments using the same options and signature.

For example, if your stream URL is `https://example.cdn.byteark.com/live/playlist.m3u8`, you may use `/live/` as a path prefix.

```
$signer = new \ByteArk\Signer\ByteArkV2UrlSigner([
    'access_id' => '',
    'access_secret' => '',
]);

$signedUrl = $signer->sign(
    'https://example.cdn.byteark.com/live/playlist.m3u8',
    1514764800,
    [
        'method' => 'GET',
        'path_prefix' => '/live/',
    ]
);

echo $signedUrl;

/*
Output:
https://example.cdn.byteark.com/live/playlist.m3u8
    ?x_ark_access_id=2Aj6Wkge4hi1ZYLp0DBG
    &x_ark_auth_type=ark-v2
    &x_ark_expires=1514764800
    &x_ark_path_prefix=%2Flive%2F
    &x_ark_signature=7JGsff2mBQEOoSYHTjxiVQ
*/
```

Options
-------

[](#options)

### ByteArkV2UrlSigner

[](#bytearkv2urlsigner)

OptionRequiredDefaultDescriptionaccess\_idRequired-Access key ID for signingacesss\_secretRequired-Access key secret for signingdefault\_age-900Default signed URL age (in seconds), if signing without expired date/time### ByteArkV2UrlSigner.sign(url, expires = null, options = \[\])

[](#bytearkv2urlsignersignurl-expires--null-options--)

OptionRequiredDefaultDescriptionmethod-GETHTTP Method that allowed to use with the signed URLpath\_prefix--Path prefix that allowed to use with the signed URL (the same signing options and signature can be reuse with theUsing RequestInfo class
-----------------------

[](#using-requestinfo-class)

(This is useful for legacy signing conditions, such as client\_ip and user\_agent).

After create a RequestInfo instance, you may use `getCurrentUrl` method to help you get current URL, and use `get` method to get values for some of these policies:

- client\_ip
- user\_agent

For example:

```
$requestInfo = new \ByteArk\Request\RequestInfo();
$signer = new \ByteArk\Signer\ByteArkV2UrlSigner([
    'access_id' => '',
    'access_secret' => '',
]);

$signedUrl = $signer->sign(
    'http://inox.qoder.byteark.com/video-objects/QDuxJm02TYqJ/playlist.m3u8',
    1514764800,
    [
        'method' => 'GET',
        'path_prefix' => '/video-objects/QDuxJm02TYqJ/',
        'referer' => $requestInfo->getCurrentUrl()
    ]
);
```

Example Projects
----------------

[](#example-projects)

You may try [the sample project](https://github.com/byteark/byteark-sdk-php-example)that allows you to create signed URLs with simple web form.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance46

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

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 ~131 days

Recently: every ~286 days

Total

10

Last Release

2182d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2ffd091bfd7e6ed07cfac0b94acec8c8eb5493c57d0b9f12f3940b3cbadfed7?d=identicon)[champjss](/maintainers/champjss)

---

Top Contributors

[![champjss](https://avatars.githubusercontent.com/u/58912?v=4)](https://github.com/champjss "champjss (14 commits)")[![icez](https://avatars.githubusercontent.com/u/568485?v=4)](https://github.com/icez "icez (2 commits)")

---

Tags

bytearkphpbyteark

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/byteark-byteark-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/byteark-byteark-sdk-php/health.svg)](https://phpackages.com/packages/byteark-byteark-sdk-php)
```

###  Alternatives

[andegna/calender

If you ever want to convert Ethiopian Calender to any other calender system (like the Gregorian Calender) this is the right package for you. And by the way it also support Amharic date formatting and much much more.

7418.9k](/packages/andegna-calender)

PHPackages © 2026

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