From afca828167e8545c5150ea8c6bd2c829c7062d17 Mon Sep 17 00:00:00 2001 From: Luca Patera Date: Sat, 29 Sep 2018 18:04:23 +0200 Subject: [PATCH] Removed constants Updated readme --- README.md | 38 ++++++++++++++++++++++++++------------ src/MCPremium.php | 12 ++++++------ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 045b7a9..44688cc 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,31 @@ -# PHP Minecraft Premium Account Checker +# Minecraft Premium Account Checker -This library can be used to check if an Minecraft account is premium. +> This library can be used to check if an Minecraft account is premium. **Warning: making too many request in a short period of time, the webserver IP will be temporary banned (about 15min) from Mojang API.** +Requirements +------------ +* PHP >= 5.6 + +Installation +--------- + +* #### Manual + Copy the `src` folder in your project, rename it and include all classes in your script. +* #### Composer + `composer require lukasss93/minecraft-premium-account-checker` + #### Using ```php Check( 'username', 'password' )->Response() ); + use MCPremium\MCPremium; + $response=MCPremium::check('username','password'); ?> ``` #### Input -The `Check()` method has 2 parameters: +The `check()` method has 2 parameters: \# | Parameter | Type | Description ---|-----------|------|------------ @@ -23,14 +33,18 @@ The `Check()` method has 2 parameters: 2 | password | string| Minecraft account password #### Output -The `Response()` method return an array with the following keys: +The `check()` method returns an object with the following properties: -Key|Type|Description +Property|Type|Description ---|----|------------ -premium|bool|Returns `true` if the account is premium else `false` -error|string|Returns any error message +premium|bool|Returns `true` if the account is premium, otherwise `false` +error|string|Returns an error message username|string|Returns the entered username correct_username|string|Returns the in-game username uuid|string|Returns the account UUID +created_at|integer|Returns the creation timestamp account +raw|array|Returns the original response from the API + +_You can use the_ `toArray()` _method after_ `check()` _method to get the properties as an array._ -**I assume no liability for any theft of Minecraft Accounts.** \ No newline at end of file +**I assume no liability for any theft of Minecraft Accounts.** diff --git a/src/MCPremium.php b/src/MCPremium.php index c7cf236..b180172 100644 --- a/src/MCPremium.php +++ b/src/MCPremium.php @@ -12,9 +12,9 @@ * @package MCPremium */ class MCPremium { - const game = "Minecraft"; - const version = 12; - const api = "https://authserver.mojang.com/authenticate"; + private static $game = "Minecraft"; + private static $version = 12; + private static $api = "https://authserver.mojang.com/authenticate"; private function __construct() {} @@ -29,8 +29,8 @@ public static function check($username, $password) { //build parameters $parameters = [ 'agent' => [ - 'name' => self::game, - 'version' => self::version + 'name' => self::$game, + 'version' => self::$version ], 'username' => (string)$username, 'password' => (string)$password @@ -45,7 +45,7 @@ public static function check($username, $password) { try { //send request - $response = $client->post(self::api, [ + $response = $client->post(self::$api, [ 'json' => $parameters ]); }