Published November 18th at 9:56am - 382 ♥ - 3 min read
Hive PHP Lib - First production version update
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!
For those who don't know, 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.
New Condenser API methods
To bring Hive-PHP-Lib in a production version, I add more methods for Condenser API (the production API used by Hive):
So, almost all methods for Condenser API are implemented in PHP. Of course, each method have his phpDoc block.
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, 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? 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
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, phpDox, ...).
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!
Hive-Engine History integration
Hive-Engine has two types of nodes: Standard node and History node. In Hive-PHP-Lib, we can now interact with the second one. The three methods are implemented:
- accountHistory($account, $limit)
- nftHistory($nfts, $symbol)
Maybe you don't know, but I've a project who checks the Hive-Engine nodes health. It's NetworkStatus, 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? 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:
use Hive\PhpLib\NetStat; $api = new netStat(); $result = $api->getEngineBestNode();
To bring the best possible quality, 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 standard filesystem skeleton, and you can check that with the
composer pds command.
At this time, I bring Psalm to level 3 and PHPStan to level 5 but the target is to have level 1 for both.
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
If you want to support this project and all the HiveLive universe projects:
- Upvote and/or reblog this post
- Comment if you have feedback / question or feature request
- Please consider to make a donation
Also, if you want to talk with me and many other great members, you can join the official HiveLive Discord Server