Hello everyone! This time, I've made some things to attract more PHP developers on Hive. Ladies and Gentlemen, please welcome the first production version of [**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib)! ![Light Hive PHP Lib logo on dark background](https://images.ecency.com/DQmW31Q3CfHqb8BHphGW6CLUba3JD1ezB4gViaeXVdzTwgR/gbsn.png) For those who don't know, [**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib) is a PHP Library made to interact more easily with HIVE blockchain. Instead of writing many lines of code with cURL and use a "raw style" every time you made a query, this library use easier functions/method for that. This project is release under the open-source [MIT license](https://opensource.org/license/mit/). Many things are added, and it's time to take a tour of the news features. You can download it now : [Last release](https://gitlab.syncad.com/hive/[**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib)/-/releases/v1.0.1) ## New Condenser API methods To bring [**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib) in a production version, I add more methods for Condenser API (the production API used by Hive): - get_market_history - get_market_history_buckets - get_order_book - get_recent_trades - get_trade_history - get_volume - list_proposal_votes - list_proposals - verify_authority So, almost all methods for Condenser API are implemented in PHP. Of course, each method have his phpDoc block. ---
Any PHP developer can now create a Hive project with PHP!
--- ## New APIs It's OK for production but I also add some tests API for new devs: **Rewards API** and **RC API**. Each API is now implemented in PHP and can be used right now. As every method in [**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib), you can check the phpDoc for each function. Don't forget: the Rewards API is for testing purpose only, don't use it on production. ## Raw style example Remember the start of this post? I've talked about "Raw style.". Do you know you can do that too on [**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib)? For only one reason: If HIVE blockchain will have a new HardFork, and if I don't have time to update this lib before the HF, you can still use it for new functions with Raw style. If you need to use it, don't panic, I add a documented example file (in `/resources/example`). ## More docs & examples I want to bring HIVE to new PHP developers (some beginners or students). That's why I added phpDoc blocks everywhere in the code. The documentation can be generated with any phpDoc software (Like [phpDocumentor](https://www.phpdoc.org/), [phpDox](https://phpdox.net/), ...). Also, each Hive method have a `@link` tag which leads to Hive Developer portal. It's useful when you need more information about parameters or return data. To finish with documentation, I fixed some typo errors or bad comments. Why I do that? It's simple, just go to the `/docs/` folder and you'll see the entire developer documentation for each function in [**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib)! ## Hive-Engine History integration Hive-Engine has two types of nodes: Standard node and History node. In [**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib), we can now interact with the second one. The three methods are implemented: - accountHistory($account, $limit) - marketHistory($symbol) - nftHistory($nfts, $symbol) ## NetworkStatus integration Maybe you don't know, but I've a project who checks the Hive-Engine nodes health. It's [NetworkStatus](https://netstat.hivelive.me/), a small API for developers who need to avoid node errors. Now, you can take the best online node before sending your query. What does that have to do with [**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib)? It's simple, the API calls are embedded is this library! Write three lines of code, and you get the best online node to interact with Hive-Engine: ```php use Hive\PhpLib\NetStat; $api = new netStat(); $result = $api->getEngineBestNode(); ``` ![Developer by Innovalabs](https://images.ecency.com/DQmcHBLQwmSrbJyJh96bGVBSmrpeYayF6AwVeXMrGrdbon3/software_developer_6521720_1280.jpg) ## Code Quality To bring the best possible quality, [**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib) use static analysis tools. I do my best to follow the PHP Standard Recommendations to create this API. The code must be clear and understandable by every PHP developer. To start, I follow [PHP-PDS](http://php-pds.com/) standard filesystem skeleton, and you can check that with the `composer pds` command. About the code, every file is [PSR-1](https://www.php-fig.org/psr/psr-1) and [PSR-12](https://www.php-fig.org/psr/psr-12) compliant. You can also check that with a command: `composer psr` I implement a [Psalm](https://psalm.dev/) config file for those who use this static analysis tool, but it's not the only one! You can also use `composer phpstan` command to create a [PHPStan](https://phpstan.org/) instant report. At this time, I bring Psalm to level 3 and PHPStan to level 5 but the target is to have level 1 for both. ## Fixes Small features/fixes are also added : - [Feature] Add encodePublicKey() and decodePublicKey() functions - [Feature] Add Hive-Engine getRichList() shortcut function - [Fix] Hive-engine getBlockInfo() bad type bug - [Fix] Default values for config array when not declared by user - [Fix] Debug message Display - [Fix] Extra slash in NetworkStatus endpoints - [Fix] HiveSQL status typo in endpoint ## Conclusion It's been awhile from the [last update](https://peakd.com/hive-139531/@bambukah/hive-php-lib-update-new) (Jul 14, 2023) and I hope this one will attract more developers to Hive Blockchain. Before this version, [**Hive-PHP-Lib**](https://gitlab.syncad.com/hive/hive-php-lib) had more than 150 downloads. If you want to support this project and all the [HiveLive](https://hivelive.me/) universe projects: - Upvote and/or reblog this post - Comment if you have feedback / question or feature request - Please consider to make a [donation](https://stream.hivelive.me/donate/bambukah) Also, if you want to talk with me and many other great members, you can join the official [HiveLive Discord Server](https://discord.gg/u2qfuaFMwt) --- Photo credit : Image by Innova Labs from Pixabay