Hub Culture Developer Portal


Hedera PHP SDK

  • Created : Nov, 01, 2025
  • Last Updated: Nov, 01, 2025

The hub/hedera-sdk-php package provides a clean and native PHP interface to interact with the Hedera Hashgraph network. It enables developers to integrate Hedera services into PHP applications within the Hub Culture code ecosystem with minimal setup or learning curve.

Package link on Packagist: https://packagist.org/packages/hub/hedera-sdk-php

Key Capabilities

This SDK allows developers to:

  • Connect to Hedera testnet or mainnet using a simple PHP client
  • Run account and hcs operations
  • Send and receive consensus messages
  • Avoid low level gRPC or protobuf complexity
  • Integrate Hedera into PHP based platforms and microservices efficiently

Installation

composer require hub/hedera-sdk-php

Example


require 'vendor/autoload.php';

use HederaSdk\Client;

$client = new Client(
    'testnet.mirrornode.hedera.com', // some public mirror node used to read topics .
    '50.18.132.211:50211', // some public node, as listed at https://hashscan.io/testnet/nodes/table. It can be a domain name too.
    3, // node number corresponding to the previous address, also available at https://hashscan.io/testnet/nodes/table .
    '302e020100300506032b65700422042084657f891c87139bed6464f645718b3406f4c7619e421c202e8c96c0502a7971', // a DER encoded private key.
    7153058 // num part of account 0.0.7153058, corresponding to the previous private key.
);
$transactionId = $client->createTopic(20000000); // 20000000 tinybars of fee

sleep(2); // Wait for the trx to broadcast on network and reach consensus
$receipt = $client->getTransactionReceipts($transactionId); // get receipt information after trx was broadcasted
$status = $receipt->getStatus(); // check if trx was successful by checking if $status equals to ResponseCodeEnum::SUCCESS
$topicId = $receipt->getTopicID(); // get result information from receipt. TopicId in this case

// submit a test message to newly created topic
$client->submitMessage(
    20000000, // 20000000 tinybars of fee
    $topicId->getTopicNum(),
    'Test message for subscription'
);
                

Best Practices

  • Start development on testnet before moving to mainnet for production
  • Store account IDs and private keys securely in environment variables
  • Monitor transaction fees and performance when running high volume operations
  • Keep the package updated to remain aligned with latest Hedera network updates

Visit the package link above for version history and installation details. More usage examples and extended documentation will be added to this page as the package evolves.