PHPackages                             activeledger/sdk - 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. [API Development](/categories/api)
4. /
5. activeledger/sdk

ActiveLibrary[API Development](/categories/api)

activeledger/sdk
================

PHP package for use when integrating with Activeledger

0.0.1(7y ago)2152MITPHPPHP ~5.6|~7.0

Since Nov 2Pushed 1y ago2 watchersCompare

[ Source](https://github.com/activeledger/SDK-PHP)[ Packagist](https://packagist.org/packages/activeledger/sdk)[ Docs](http://www.activeledger.io)[ RSS](/packages/activeledger-sdk/feed)WikiDiscussions master Synced 1mo ago

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

[![Activeledger](https://camo.githubusercontent.com/51bf9a0d3136bb9a10218f469ed0c23b865d9d1816aa11e6cef5b76f3d241bde/68747470733a2f2f7777772e6163746976656c65646765722e696f2f77702d636f6e74656e742f75706c6f6164732f323031382f30392f41737365742d32332e706e67)](https://camo.githubusercontent.com/51bf9a0d3136bb9a10218f469ed0c23b865d9d1816aa11e6cef5b76f3d241bde/68747470733a2f2f7777772e6163746976656c65646765722e696f2f77702d636f6e74656e742f75706c6f6164732f323031382f30392f41737365742d32332e706e67)

Activeledger - PHP SDK
======================

[](#activeledger---php-sdk)

The Activeledger PHP SDK has been built to provide an easy way to connect your php web application to an Activeledger Network

### Activeledger

[](#activeledger)

[Visit Activeledger.io](https://activeledger.io/)

[Read Activeledgers documentation](https://github.com/activeledger/activeledger)

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

[](#installation)

```
$ composer require activeledger/sdk ~0.0.1
$ composer install -o

```

Usage
-----

[](#usage)

The SDK currently supports the following functionality

- Connection handling
- Key generation
- Key onboarding
- Transaction building
- Encrypted &amp; unencrypted transaction posting

Once the SDK has been installed import the classes with the autoloader

```
require __DIR__ . '/vendor/autoload.php';
```

### Connection

[](#connection)

When sending a transaction, you must pass a connection that provides the information needed to establish a link to the network and specified node.

To do this a connection object must be created. This object must be passed the protocol, address, port, and the encryption flag.

#### Example

[](#example)

```
require __DIR__ . '/vendor/autoload.php';

// Setup the connection object to use localhost over http unencrypted
$connection = new activeledger\sdk\Connection("http", "127.0.0.1", 5260, false);

// Use localhost but encrypt transactions
$connection = new activeledger\sdk\Connection("http", "127.0.0.1", 5260, true);
```

---

### Key

[](#key)

The Key class can be used to generate a key.

There are two key types that can be generated currently, more are planned and will be implemented into Activeledger first. These types are RSA and Elliptic Curve.

#### Generating a key

[](#generating-a-key)

When generating a key the default is an Elliptic Curve key. The object returned will be a KeyIdentity class.

##### Example

[](#example-1)

```
require __DIR__ . '/vendor/autoload.php';

// Generate Elliptic Key
$identity = activeledger\sdk\Key::generateKeyIdentity();

// Generate RSA Key
$identity = activeledger\sdk\Key::generateKeyIdentity("rsa");
```

#### Onboarding a key

[](#onboarding-a-key)

Once you have a key generated, to use it to sign transactions it must be onboarded to the ledger network

##### Example

[](#example-2)

```
require __DIR__ . '/vendor/autoload.php';

// Create Connection
$connection = new activeledger\sdk\Connection("http", "127.0.0.1", 5260, false);

// Generate Key
$identity = activeledger\sdk\Key::generateKeyIdentity();

try {
    // Onboard Key
    $stream = $identity->onBoard($connection);
}catch(Exception $error) {
    // Manage any exceptions such as consensus problem or transport errors
    die($error->getMessage());
}
```

#### Exporting Key

[](#exporting-key)

To save the key for later use you can use the php serialize function

```
require __DIR__ . '/vendor/autoload.php';

// Generate Key
$identity = activeledger\sdk\Key::generateKeyIdentity();

// Store object as a safe string
$export = base64_encode(serialize($identity));
```

#### Importing Key

[](#importing-key)

You can import a key using php unserialize function which restores the object

```
require __DIR__ . '/vendor/autoload.php';

// Restore KeyIdentity Object from the exported safe string
$identity = serialize(base64_decode($export))
```

---

### Transaction

[](#transaction)

The Transaction class contains a static function which helps build an Activeledger transaction object.

```
require __DIR__ . '/vendor/autoload.php';

// Generate Activeledger Transaction
$transaction = activeledger\sdk\Transaction::build(
    "Contract Stream / Label",
    "Namespace",
    // Input Streams (Requires Signatures)
    array("Identity Stream" => array()),
    // Outputs
    array("Outputs: Identity Stream" => array()),
    // Read Only Streams
    array("Reads : Label" => "Idenity Stream")
);
```

#### Signing &amp; sending a transaction

[](#signing--sending-a-transaction)

When signing a transaction you must send the finished version of it. No changes can be made after signing as this will cause the ledger to reject it.

The key must be one that has been successfully onboarded to the ledger which the transaction is being sent to.

##### Example

[](#example-3)

```
require __DIR__ . '/vendor/autoload.php';

// Create Connection
$connection = new activeledger\sdk\Connection("http", "127.0.0.1", 5260, false);

// Generate Key
$identity = activeledger\sdk\Key::generateKeyIdentity();

try {
    // Onboard Key
    $stream = $identity->onBoard($connection);

    // Generate Activeledger Transaction
    $transaction = activeledger\sdk\Transaction::build(
        "0000482232bcca98e3f2b375e6209400e185fae26efad7812268d7d66b321131",
        "example-namespace",
        // Input Streams (Requires Signatures)
        array($stream => array("text" => "Hello World"))
    );

    // Get signed version of this transaction
    $signedTx = $identity->sign($transaction)

    // Submit
    $response = $connection->send($signedTx);

    // Response object will contain the streams property.
    $response->streams->new; // Contains created Activity Streams
    $response->streams->updated; // Contains updated Activity Streams

}catch(Exception $error) {
    // Manage any exceptions such as consensus problem or transport errors
    die($error->getMessage());
}
```

License
-------

[](#license)

---

This project is licensed under the [MIT](https://github.com/activeledger/activeledger/blob/master/LICENSE) License

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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

Unknown

Total

1

Last Release

2745d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/28be1bdacddf4b7f554ababa64622222873c29b10b910563bb995fed1373e858?d=identicon)[admwalker](/maintainers/admwalker)

---

Top Contributors

[![AdmWalker](https://avatars.githubusercontent.com/u/2891851?v=4)](https://github.com/AdmWalker "AdmWalker (4 commits)")[![RationalInsanity](https://avatars.githubusercontent.com/u/19567795?v=4)](https://github.com/RationalInsanity "RationalInsanity (1 commits)")

---

Tags

sdknetworknodeblockchainledgersmart-contractsactiveledgerdltdistributed ledger technology

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[blocktrail/blocktrail-sdk

The BlockTrail PHP SDK, for integration of Bitcoin functionality through the BlockTrail API

4921.1k3](/packages/blocktrail-blocktrail-sdk)[make-software/casper-php-sdk

PHP 7.4+ library for interacting with Casper blockchain node RPC API.

101.9k](/packages/make-software-casper-php-sdk)[mocking-magician/coinbase-pro-sdk

Library for coinbase pro API calls

233.2k](/packages/mocking-magician-coinbase-pro-sdk)[hardcastle/xrpl_php

PHP SDK / Client for the XRP Ledger

129.7k5](/packages/hardcastle-xrpl-php)

PHPackages © 2026

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