{"id":26562915,"url":"https://github.com/aelfproject/aelf-sdk.php","last_synced_at":"2025-03-22T15:29:15.037Z","repository":{"id":47419523,"uuid":"238828601","full_name":"AElfProject/aelf-sdk.php","owner":"AElfProject","description":"AElf php SDK","archived":false,"fork":false,"pushed_at":"2023-10-26T06:54:52.000Z","size":7560,"stargazers_count":1,"open_issues_count":1,"forks_count":8,"subscribers_count":8,"default_branch":"dev","last_synced_at":"2024-03-26T17:43:46.450Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AElfProject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-02-07T02:34:53.000Z","updated_at":"2024-03-26T17:43:46.451Z","dependencies_parsed_at":"2023-10-26T07:37:41.411Z","dependency_job_id":null,"html_url":"https://github.com/AElfProject/aelf-sdk.php","commit_stats":{"total_commits":121,"total_committers":9,"mean_commits":"13.444444444444445","dds":0.6033057851239669,"last_synced_commit":"a2e3f12df8e5b38d31e17b08d6270fcb4c81c316"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf-sdk.php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf-sdk.php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf-sdk.php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf-sdk.php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AElfProject","download_url":"https://codeload.github.com/AElfProject/aelf-sdk.php/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244977788,"owners_count":20541732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-22T15:29:14.581Z","updated_at":"2025-03-22T15:29:15.028Z","avatar_url":"https://github.com/AElfProject.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AElf-sdk.php\r\n\r\n#Introduction\r\n\r\nThis is a PHP client library, used to communicate with the [AElf](https://github.com/AElfProject/AElf)  API.\r\n\r\n## Installation\r\nAElf php SDK\r\n\r\nIn order to install this library via composer run the following command in the console:\r\n\r\n```lang=bash\r\n$ composer require aelf/aelf-sdk\r\n```\r\ncomposer require curl/curl\r\n\r\nIf you directly clone the sdk You must install composer and execute it in the root directory \r\n\r\n```lang=bash\r\n\"aelf/aelf-sdk\": \"dev-dev\"\r\n```\r\n\r\n## Environment configuration And extensions that need to be turned on\r\n\r\n```lang=bash\r\n1. PHP =\u003e 7.0\r\n2. gmp\r\n3. curl\r\n```\r\n\r\n## Basic usage\r\n    \r\n```php\r\nrequire_once 'vendor/autoload.php';\r\nuse AElf\\AElf;\r\n$url = '127.0.0.1:8000';\r\n$aelfClient = new AElf($url);\r\n$height = $aelfClient-\u003eGetBlockHeight();\r\n```\r\n### Examples\r\n\r\nYou can also see full examples in `./example`;\r\n\r\n### Interface\r\n\r\nInterface methods can be easily available by the instance \"aelfClient\" shown in basic usage. The following is a list of input parameters and output for each method. Check out the [Web api reference](https://docs.aelf.io/v/dev/reference) for detailed Interface description.\r\n\r\n#### IBlockAppService\r\n\r\n```php\r\npublic function getBlockHeight();\r\n\r\npublic function getBlockByHash($blockHash,$includeTransactions = false);\r\n\r\npublic function getBlockByHeight($blockHeight,$includeTransactions = false);\r\n\r\n```\r\n\r\n#### IChainAppService\r\n\r\n```php\r\npublic function getChainStatus();\r\n\r\npublic function getContractFileDescriptorSet($address);\r\n\r\npublic function getCurrentRoundInformationAsync();\r\n\r\npublic function getTaskQueueStatusAsync();\r\n\r\npublic function getChainIdAsync();\r\n```\r\n#### INetAppService\r\n\r\n```php\r\n public function addPeer($address);\r\n\r\n public function removePeer($address);\r\n\r\n public function getPeers($withMetrics);\r\n\r\n public function getNetworkInfo();\r\n```\r\n#### ITransactionAppService\r\n\r\n```php\r\npublic function getTransactionPoolStatus();\r\n\r\npublic function executeTransaction($input);\r\n\r\npublic function executeRawTransaction($input);\r\n\r\npublic function createRawTransaction($input);\r\n\r\npublic function sendRawTransaction($input);\r\n\r\npublic function sendTransaction($input);\r\n\r\npublic function sendTransactions($input);\r\n\r\npublic function getTransactionResult($transactionId);\r\n\r\npublic function getTransactionResults($blockHash, $offset = 0, $limit = 10);\r\n\r\npublic function getMerklePathByTransactionId($transactionId);\r\n```\r\n\r\n#### IClientService\r\n\r\n```php\r\npublic function isConnected();\r\n\r\npublic function getFormattedAddress($privateKey, $address);\r\n\r\npublic function getAddressFromPubKey($pubKey) ;\r\n\r\npublic function getGenesisContractAddress();\r\n\r\npublic function getContractAddressByName($privateKey, $contractNameHash);\r\n```\r\n### Test\r\n\r\nThis module contains tests for all services provided by AElf. You can see how to properly use services provided by AElf here.\r\n\r\nYou need to firstly set necessary parameters to make sure tests can run successfully.\r\n\r\n1. Set baseUrl to your target url.\r\n\r\n   \r\n   ```php\r\n\r\n   $url = \"Http://127.0.0.1:8001\";\r\n   ```\r\n\r\n\r\n2. Give a valid privateKey of a node.\r\n\r\n   ```php\r\n   $this-\u003eprivateKey = 'be3abe5c1439899ac2efd0001e15715fd989a3ae11f09e1cb95d320cd4993e2a';\r\n   ```\r\n\r\n### Note\r\n\r\nYou need to run a local or remote AElf node to run the unit test successfully. If you're not familiar with how to run a node or multiple nodes, please see [Running a node](https://docs.AElf.io/v/dev/main/main/run-node) / [Running multiple nodes](https://docs.AElf.io/v/dev/main/main/multi-nodes) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faelfproject%2Faelf-sdk.php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faelfproject%2Faelf-sdk.php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faelfproject%2Faelf-sdk.php/lists"}