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.
This project is release under the open-source MIT license. Many things are added, and it's time to take a tour of the news features. You can download it now : Last release
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):
- 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, 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 /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, 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)
- 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, 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();
Code Quality
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.
About the code, every file is PSR-1 and PSR-12 compliant. You can also check that with a command: composer psr
I implement a Psalm 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 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 (Jul 14, 2023) and I hope this one will attract more developers to Hive Blockchain. Before this version, Hive-PHP-Lib had more than 150 downloads.
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
Photo credit : Image by Innova Labs from Pixabay
Congrats on your development! Will this be used in Superhive?
It's already that :)
I use it for every project I made for Hive!
Great to see you developing on Hive!
Thank you very much. This looks like something I need to help me integrate my Web2 services to Web3 ecosystem. Will explore some more later today.
I'll be back !lol
lolztoken.com
But I forgot to mention it to him.
Credit: reddit
@bambukah, I sent you an $LOLZ on behalf of fjworld
(2/10)
Really nice project !
!PGM
!LOLZ
lolztoken.com
You use a pumpkin patch.
Credit: reddit
@bambukah, I sent you an $LOLZ on behalf of phanty
(4/10)
Farm LOLZ tokens when you Delegate Hive or Hive Tokens.
Click to delegate: 10 - 20 - 50 - 100 HP
BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!
The tokens that the command sends are: 0.1 PGM-0.1 LVL-0.1 THGAMING-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]
5000 PGM IN STAKE = 2x rewards!
Discord
Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP
Get potential votes from @ pgm-curator by paying in PGM, here is a guide
I'm a bot, if you want a hand ask @ zottone444
💚💪
!WEED
Thank you very much, you are great!
Yay! 🤗
Your content has been boosted with Ecency Points, by @seckorama.
Use Ecency daily to boost your growth on platform!
Support Ecency
Vote for new Proposal
Delegate HP and earn more
!PGM
Curation par La Principauté du Bastion.
PS: Vous aussi pouvez aider cette curation (@hive-143869) en suivant notre trail ou en déléguant,
si vous choisissez la seconde option, vous recevrez des ECU (token stable) chaque semaine.
ItharaGaian
Principauté du Bastion (@hive-143869 Community)
Sélection Manuelle
BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!
The tokens that the command sends are: 0.1 PGM-0.1 LVL-0.1 THGAMING-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]
5000 PGM IN STAKE = 2x rewards!
Discord
Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP
Get potential votes from @ pgm-curator by paying in PGM, here is a guide
I'm a bot, if you want a hand ask @ zottone444
@bambukah!
@loonatic passed you the virtual joint!If you do not want to receive these comments, please reply with !STOP
Congratulations @bambukah! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 58000 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out our last posts: