d3strukt0r/votifier-client
Composer 安装命令:
composer require d3strukt0r/votifier-client
包简介
Simple Tool to send vote request to a server which has the Votifier plugin.
关键字:
README 文档
README
This php script allows easy using of the Bukkit plugin Votifier
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
The full documentation can be found here.
Prerequisites
What things you need to install the software and how to install them
- PHP Project (PHP 7.1+)
- Minecraft server with a Votifier plugin. NuVotifier is recommended — the
classic Votifier plugin relies on
javax.xml.bind.DatatypeConverter, which was removed from the JDK in Java 11, so it only runs on Java 8 and therefore only on Minecraft up to 1.16.5 (the last version that runs on Java 8; 1.17+ require Java 16+). On newer servers it fails to enable withNoClassDefFoundError: javax/xml/bind/DatatypeConverter. NuVotifier runs on current Java and is backwards compatible with the classic protocol.
Installing
Add the client using Composer.
composer require d3strukt0r/votifier-client
Usage
Simply create an object with all information
For the servers with the classic Votifier plugins:
<?php use D3strukt0r\Votifier\Client\Server\Votifier; $server = (new Votifier()) ->setHost('127.0.0.1') ->setPublicKey('MIIBIjANBgkq...') ;
For the servers which use the NuVotifier plugin (v1 protocol) (HINT: It's NOT the same as method 1):
<?php use D3strukt0r\Votifier\Client\Server\NuVotifier; $server = (new NuVotifier()) ->setHost('127.0.0.1') ->setPublicKey('MIIBIjANBgkq...') ;
For the servers which use the NuVotifier plugin with v2 protocol:
<?php use D3strukt0r\Votifier\Client\Server\NuVotifier; $server = (new NuVotifier()) ->setHost('127.0.0.1') ->setProtocolV2(true) ->setToken('7j302r4n...') ;
Finally, just send it.
<?php use D3strukt0r\Votifier\Client\Exception\NotVotifierException; use D3strukt0r\Votifier\Client\Exception\NuVotifierChallengeInvalidException; use D3strukt0r\Votifier\Client\Exception\NuVotifierException; use D3strukt0r\Votifier\Client\Exception\NuVotifierSignatureInvalidException; use D3strukt0r\Votifier\Client\Exception\NuVotifierUnknownServiceException; use D3strukt0r\Votifier\Client\Exception\NuVotifierUsernameTooLongException; use D3strukt0r\Votifier\Client\Exception\Socket\NoConnectionException; use D3strukt0r\Votifier\Client\Exception\Socket\PackageNotReceivedException; use D3strukt0r\Votifier\Client\Exception\Socket\PackageNotSentException; use D3strukt0r\Votifier\Client\Server\ServerInterface; use D3strukt0r\Votifier\Client\Vote\ClassicVote; $vote = (new ClassicVote()) ->setUsername($_GET['username']) ->setServiceName('Your vote list') ->setAddress($_SERVER['REMOTE_ADDR']) ; try { /** @var ServerInterface $server */ $server->sendVote($vote); // Connection created, and vote sent. Doesn't mean the server handled it correctly, but the client did. } catch (InvalidArgumentException $e) { // Not all variables that are needed have been set. See $e->getMessage() for all errors. } catch (NoConnectionException $e) { // Could not create a connection (socket) to the specified server } catch (PackageNotReceivedException $e) { // If the package couldn't be received, for whatever reason. } catch (PackageNotSentException $e) { // If the package couldn't be send, for whatever reason. } catch (NotVotifierException $e) { // The server didn't give a standard Votifier response } catch (NuVotifierChallengeInvalidException $e) { // Specific for NuVotifier: The challenge was invalid (Shouldn't happen by default, but it's here in case). } catch (NuVotifierSignatureInvalidException $e) { // Specific for NuVotifier: The signature was invalid (Shouldn't happen by default, but it's here in case). } catch (NuVotifierUnknownServiceException $e) { // Specific for NuVotifier: A token can be specific for a list, so if the list isn't supposed to use the given token, this message appears. } catch (NuVotifierUsernameTooLongException $e) { // Specific for NuVotifier: A username cannot be over 16 characters (Why? Don't ask me) } catch (NuVotifierException $e) { // In case there is a new error message that wasn't added to the library, this will take care of that. }
Running the tests
Explain how to run the automated tests for this system
Break down into end-to-end tests
Run test scripts
./vendor/bin/phpunit
Coding style tests and fixes
To check if the code follows the PSR-12 standard, the library PHP_CodeSniffer has been add to the development environment, but you can also download it separately from here and here.
To see what mistakes exist in the code run:
./vendor/bin/phpcs
To fix the code:
./vendor/bin/phpcbf
This library already comes with php-cs-fixer but because it's impossible to set it up to follow the PSR-12 standard, it's not a requirement anymore. It's been left in the project only for additional styling information that might be applied. It can also be downloaded separately from
here.
./vendor/bin/php-cs-fixer fix --diff --dry-run -v
Code documentation
Install Python v3 from here.
Install Sphinx as documented here.
pip install -U sphinx
To build the docs:
cd docs
pip install -r requirements.txt
make html
Old Code documentation
You can also create a documentation with phpDocumentor. For that please downloaded at least v3+ for to work from here. And then you can just run it
curl -fsSL -o /usr/local/bin/phpdoc https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpdoc
Built With
- PHP - Programming Language
- Composer - Dependency Management
- PHPUnit - Testing the code
- Github Actions - Automatic CI (Testing)
- Read the docs - Documentation
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project uses Conventional Commits.
Versioning
We use SemVer for versioning. For available versions, see the tags on this repository.
Authors
Special thanks for all the people who had helped this project so far
- Manuele - D3strukt0r
See also the full list of contributors who participated in this project.
I would like to join this list. How can I help the project?
We're currently looking for contributions for the following:
- Bug fixes
- Translations
- etc...
For more information, please refer to our CONTRIBUTING.md guide.
License
This project is licensed under the MIT License - see the LICENSE.txt file for details.
Acknowledgments
- Hat tip to anyone whose code was used
- Inspiration
- etc
d3strukt0r/votifier-client 适用场景与选型建议
d3strukt0r/votifier-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24.46k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2016 年 03 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「minecraft」 「vote」 「votifier」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 d3strukt0r/votifier-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 d3strukt0r/votifier-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 d3strukt0r/votifier-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Useful PHP classes for Minecraft
Allow users to use the head of a Minecraft skin as avatar.
Simple Tool to send vote request to a server which has the Votifier plugin.
Let users like things, confirm their likes via email and keep track of the count.
PHP library retrieve game servers status from various types of games.
vote
统计信息
- 总下载量: 24.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 16
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-12