Skip to content

Commit

Permalink
Removed constants
Browse files Browse the repository at this point in the history
Updated readme
  • Loading branch information
Lukasss93 committed Sep 29, 2018
1 parent 03f7043 commit afca828
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
38 changes: 26 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,50 @@
# 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
<?php
require 'MCPremium.php';

$status = new MCPremium();
print_r( $status->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
---|-----------|------|------------
1 | username | string | Minecraft account username (or email if Mojang account)
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.**
**I assume no liability for any theft of Minecraft Accounts.**
12 changes: 6 additions & 6 deletions src/MCPremium.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand All @@ -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
Expand All @@ -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
]);
}
Expand Down

0 comments on commit afca828

Please sign in to comment.