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

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

decentfoundation/dcorephp-sdk
=============================

DCore PHP SDK library

2.5.0(6y ago)1481[2 PRs](https://github.com/DECENTfoundation/DCorePHP-SDK/pulls)GPL-3.0-onlyPHPPHP &gt;=7.1

Since Mar 27Pushed 6y ago9 watchersCompare

[ Source](https://github.com/DECENTfoundation/DCorePHP-SDK)[ Packagist](https://packagist.org/packages/decentfoundation/dcorephp-sdk)[ RSS](/packages/decentfoundation-dcorephp-sdk/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (7)Dependencies (16)Versions (15)Used By (0)

DCore SDK for PHP
=================

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

Set of APIs for accessing the DCore Blockchain.
If you are looking for other platforms you can find info [below](#official-dcore-sdks-for-other-platforms).

Requirements
------------

[](#requirements)

- [composer](https://getcomposer.org)
- [php ~7.1](http://php.net)
- [php json](http://php.net/manual/en/book.json.php)
- [php bcmath](http://php.net/manual/en/book.bc.php)
- [php gmp](http://php.net/manual/en/book.gmp.php)
- [php openssl](http://php.net/manual/en/book.openssl.php)
- [symfony PropertyAccess component](https://symfony.com/doc/current/components/property_access.html)
- [websocket-php - websocket library](https://github.com/Textalk/websocket-php)
- [stephen-hill/base58php - base58 conversion library](https://github.com/stephen-hill/base58php)
- [kornrunner/php-secp256k1 - secp256k1 library](https://github.com/kornrunner/php-secp256k1)
- [BitcoinPHP/BitcoinECDSA.php - ecdsa library](https://github.com/BitcoinPHP/BitcoinECDSA.php)

Instalation
-----------

[](#instalation)

composer.json

```
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/decentfoundation/dcorephp-sdk"
        }
    ],
    "require": {
        "decentfoundation/dcorephp-sdk": "dev-master"
    }
}
```

```
composer require decentfoundation/dcorephp-sdk
```

Usage
-----

[](#usage)

You can find example project with SDK usage [here](https://github.com/DECENTfoundation/DCore-SDK-Examples/tree/master/sdk-php).

You can find developer documentation for latest release [here](https://decentfoundation.github.io/DCorePHP-SDK/).

### DCore API initialization

[](#dcore-api-initialization)

```
$dcoreApi = new \DCorePHP\DCoreApi(
    'https://testnet.dcore.io/',
    'wss://testnet-socket.dcore.io'
);
```

Look at ./src/DCoreApi.php and ./src/Sdk/\*Interface.php to see all available methods and their return values.

### Get account

[](#get-account)

```
$account = $dcoreApi->getAccountApi()->get(new ChainObject('1.2.34'));
$account = $dcoreApi->getAccountApi()->getByName('Your test account name');
```

### Create account

[](#create-account)

There are two ways to create account in DCore network: `$dcoreApi->getAccountApi()->registerAccount()` and `$dcoreApi->getAccountApi()->createAccountWithBrainKey()`. Recommended way to create account is using `$dcoreApi->getAccountApi()->registerAccount()` method, because it has an option to specify keys. You can use `$dcoreApi->getAccountApi()->createAccountWithBrainKey()`, but keys generated from `$brainkey` for `$publicOwnerKeyWif`, `$publicActiveKeyWif` and `$publicMemoKeyWif` will be the same, which is not recommended for security reasons.

```
$dcoreApi->getAccountApi()->registerAccount(
    'Your test account name',
    'DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz',
    'DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz',
    'DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz',
    new ChainObject('1.2.34'),
    '5Jd7zdvxXYNdUfnEXt5XokrE3zwJSs734yQ36a1YaqioRTGGLtn'
);
```

### Create transfer

[](#create-transfer)

```
$dcoreApi->getAccountApi()->transfer(
    new Credentials(new ChainObject('1.2.34'), '5Jd7zdvxXYNdUfnEXt5XokrE3zwJSs734yQ36a1YaqioRTGGLtn'),
    '1.2.35',
    (new AssetAmount())->setAmount(1500000),
    'your secret message',
    false
);
```

### Create content

[](#create-content)

```
$content = new SubmitContent();
$content
    ->setUri($randomUri)
    ->setCoauthors([])
    ->setCustodyData(null)
    ->setHash('2222222222222222222222222222222222222222')
    ->setKeyParts([])
    ->setSeeders([])
    ->setQuorum(0)
    ->setSize(10000)
    ->setSynopsis(json_encode([
        'title' => 'Your content title',
        'description' => 'Your content description',
        'content_type_id' => '1.2.3'
    ]))
    ->setExpiration('2019-05-28T13:32:34+00:00')
    ->setPrice([(new RegionalPrice)->setPrice((new AssetAmount())->setAmount(1000))->setRegion(1)]);

$credentials = new Credentials(
    new ChainObject('1.2.34'),
    ECKeyPair::fromBase58(DCoreSDKTest::PRIVATE_KEY_1)
);

$dcoreApi->getContentApi()->create(
    $content,
    $credentials,
    (new AssetAmount())->setAmount(1000)->setAssetId('1.3.0'),
    (new AssetAmount())->setAmount(1000)->setAssetId('1.3.0')
);
```

### Search content

[](#search-content)

```
$contents = $dcoreApi->getContentApi()->findAll(
    'search term',
    '-rating'
);
```

### NFT

[](#nft)

NftModels **require** `@Type("type")` annotation for correct functioning. [GMP library](https://www.php.net/manual/en/intro.gmp.php) is also **necessary** when working with integers.

#### NftModel

[](#nftmodel)

```
class NftApple extends NftModel
{
    /**
     * @Type("integer")
     */
    public $size;
    /**
     * @Type("string")
     * @Unique
     */
    public $color;
    /**
     * @Type("boolean")
     * @Modifiable("both")
     */
    public $eaten;

    public function __construct($size, $color, $eaten)
    {
        $this->size = gmp_init($size);
        $this->color = $color;
        $this->eaten = $eaten;
    }
}
```

#### Create NFT

[](#create-nft)

```
$credentials = new Credentials(new ChainObject('1.2.27'), ECKeyPair::fromBase58('DCT6MA5TQQ6UbMyMaLPmPXE2Syh5G3ZVhv5SbFedqLPqdFChSeqTz'));
$dcoreApi->getNftApi()->create($credentials, 'APPLE', 100, false, 'an apple', NftApple::class, true);
```

More examples can be found in ./tests/Sdk/NftApiTest.php.

### Development requirements &amp; recommendations

[](#development-requirements--recommendations)

- [docker](https://docs.docker.com/install/)
- [docker-compose](https://docs.docker.com/compose/install/)
- [phpunit](https://phpunit.de/)
- [symfony VarDumper component](https://symfony.com/doc/current/components/var_dumper.html)
- [php code sniffer](https://github.com/squizlabs/PHP_CodeSniffer)
- [php code sniffer fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)
- [php mess detector](https://github.com/phpmd/phpmd)

### PHPStorm configuration

[](#phpstorm-configuration)

-
-
-

Development &amp; testing
-------------------------

[](#development--testing)

```
git clone git@github.com:decentfoundation/dcorephp-sdk.git
cd dcorephp-sdk
docker-compose up -d
docker-compose exec php composer install --dev --prefer-dist --optimize-autoloader
docker-compose exec php ./vendor/bin/phpunit --bootstrap vendor/autoload.php tests
```

Official DCore SDKs for other platforms
---------------------------------------

[](#official-dcore-sdks-for-other-platforms)

- [iOS/Swift](https://github.com/DECENTfoundation/DCoreSwift-SDK)
- [Android/Java/Kotlin](https://github.com/DECENTfoundation/DCoreKt-SDK)
- [JavaScript/TypeScript/Node.js](https://github.com/DECENTfoundation/DCoreJS-SDK)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 58.3% 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 ~20 days

Total

7

Last Release

2528d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/45463125?v=4)[Peter Vanderka](/maintainers/petervanderkadecent)[@petervanderkadecent](https://github.com/petervanderkadecent)

---

Top Contributors

[![iammatis](https://avatars.githubusercontent.com/u/9095130?v=4)](https://github.com/iammatis "iammatis (42 commits)")[![ttibensky](https://avatars.githubusercontent.com/u/5850762?v=4)](https://github.com/ttibensky "ttibensky (20 commits)")[![petervanderkadecent](https://avatars.githubusercontent.com/u/45463125?v=4)](https://github.com/petervanderkadecent "petervanderkadecent (10 commits)")

---

Tags

dcoredcore-sdkphpsdk

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k50.1M314](/packages/api-platform-core)[api-platform/serializer

API Platform core Serializer

244.3M71](/packages/api-platform-serializer)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

51390.8k3](/packages/web-auth-webauthn-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M526](/packages/shopware-core)[chameleon-system/chameleon-base

The Chameleon System core.

1027.9k4](/packages/chameleon-system-chameleon-base)[oro/platform

Business Application Platform (BAP)

642140.7k104](/packages/oro-platform)

PHPackages © 2026

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