2017 © Pedro Peláez
 

library devrant-php

A simple PHP wrapper for utilising the devRant API.

image

pxgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  • Wednesday, December 6, 2017
  • by PXgamer
  • Repository
  • 2 Watchers
  • 6 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 17 Versions
  • 0 % Grown

The README.md

devrant-php

Build Status, (*1)

A simple PHP wrapper for utilising the devRant api., (*2)

Usage

Include the class: - Using Composer, (*3)

composer require pxgamer/devrant-php, (*4)

<?php
require 'vendor/autoload.php';
  • Including the files manually
<?php
include 'src/Connection.php';
include 'src/Rant.php';

Once included, you can initialise the class using either of the following:, (*5)

$devRant = new \pxgamer\devRant\Connection();

```php use \pxgamer\devRant\Connection; $devRant = new Connection();, (*6)


## Class Methods Method Name | Parameters | Returns --------------------- | ---------- | ------- getRants($searchterm) | string (optional) | `array of Rant objects` getRantById($id) | int | `Rant object` getUserById($id) | int | `array` getUsersId($username) | string | `array` login($username, $password) | strings | `boolean` logout() | void | `void` rant($rant) | Rant object | `array` comment($rantId, $comment) | mixed | `array` voteRant($rantId, $vote) | mixed | `array` voteComment($commentId, $vote) | mixed | `array` notifs() | void | `array` collabs() | void | `array` deleteRant($rantId) | int | `array` deleteComment($commentId) | int | `array` deleteAccount() | void | `array` ## Examples ### _Getting array of rants_ ```php $devRant = new \pxgamer\devRant\Connection; $devRant->getRants(); // Get rants $devRant->getRants($searchterm); // Get rants using a search query

Returns false on failure, or:, (*7)

[
    0 => Rant object,
    1 => Rant object,
    ...
]

Getting a single rant by its id

$devRant = new \pxgamer\devRant\Connection;
$devRant->getRantById(int);

Returns false on failure, or a Rant object., (*8)

Getting a user by their id

$devRant = new \pxgamer\devRant\Connection;
$devRant->getUserById(int);

Returns:, (*9)

[
    "success" => true,
    "profile" => [
        "username" => "",
        "score" => 0,
        "about" => "",
        "location" => "",
        "created_time" => 1474613872,
        "skills" => "",
        "github" => "",
        "website" => "",
        "content" => [
            "content" => [
                "rants" => [],
                "upvoted" => [],
                "comments" => [],
                "favorites" => []
            [,
            "counts" => []
        ],
        "avatar" => []
    ]
]

Search rants

$devRant = new \pxgamer\devRant\Connection;
$devRant->getRants('string');

Returns false on failure, or:, (*10)

[
    0 => Rant object [
        "id" => 0,
        "text" => "string",
        "num_upvotes" => 0,
        "num_downvotes" => 0,
        "score" => 0,
        "created_time" => 0,
        "attached_image" => [
            "url" => "string",
            "width" => 0,
            "height" => 0
        ],
        "num_comments" => 0,
        "tags" => [
            "string"
        ],
        "vote_state" => 0,
        "edited" => false,
        "user_id" => 0,
        "user_username" => "string",
        "user_score" => 0,
        "user_avatar" => [
            "b" => "string"
        ]
    ],
    1 => Rant object,
    ...
]

Getting a user's id from their username

$devRant = new \pxgamer\devRant\Connection;
$devRant->getUserId('username');

Returns:, (*11)

[
    "success" => true,
    "user_id" => 0
]

Getting signed in

$devRant = new \pxgamer\devRant\Connection;
$devRant->login('username', 'password');

Returns true if successful, false if not, (*12)

Posting a rant

use \pxgamer\devRant\Rant;

$devRant = new \pxgamer\devRant\Connection;
if ($devRant->login('username', 'password')) {
    $devRant->rant(new Rant($rant_content, $tags));
}

Returns:, (*13)

[
    "success" => true,
    "rant_id" => 31131
]

Posting a comment

$devRant = new \pxgamer\devRant\Connection;
if ($devRant->login('username', 'password')) {
    $devRant->comment($rantId, 'Comment Content');
}

Returns:, (*14)

[
    "success" => true
]

Getting Collabs

$devRant = new \pxgamer\devRant\Connection;

$collabs = $devRant->collabs();

Returns:, (*15)

[
    "success" => true,
    "rants" => [
        [0] => [
            ...
        ]
    ]
]

Voting on Rants

$devRant = new \pxgamer\devRant\Connection;
if ($devRant->login('username', 'password')) {
    $voteRant = $devRant->voteRant($rantId, $vote);
}

Returns:, (*16)

[
    "success" => true,
    "rant" => [
        [id] => ...,
        ...
    ]
]

Voting on Comments

$devRant = new \pxgamer\devRant\Connection;
if ($devRant->login('username', 'password')) {
    $voteRant = $devRant->voteComment($commentId, $vote);
}

Returns:, (*17)

[
    "success" => true,
    "comment" => [
        [id] => ...,
        ...
    ]
]

Getting your notifications

$devRant = new \pxgamer\devRant\Connection;
if ($devRant->login('username', 'password')) {
    $notifications = $devRant->notifs();
}

Returns:, (*18)

[
    "success" => true,
    "data" => {
        "items" => [
            ...
        ],
        "check_time" => 11111,
        "username_map" => {
            ...
        }
    }
]

Deleting a rant

Please note that this will permanently delete the rant from devRant., (*19)

$devRant = new \pxgamer\devRant\Connection;
if ($devRant->login('username', 'password')) {
    $devRant->deleteRant($rantId);
}

Returns:, (*20)

[
    "success" => true
]

Deleting a comment

Please note that this will permanently delete the comment from devRant., (*21)

$devRant = new \pxgamer\devRant\Connection;
if ($devRant->login('username', 'password')) {
    $devRant->deleteComment($commentId);
}

Returns:, (*22)

[
    "success" => true
]

Deleting your account

Please note that this will permanently delete your account from devRant., (*23)

$devRant = new \pxgamer\devRant\Connection;
if ($devRant->login('username', 'password')) {
    $devRant->deleteAccount();
}

Returns:, (*24)

[
    "success" => true
]

License

The MIT License (MIT). Please see License File for more information., (*25)

The Versions

06/12 2017

dev-master

9999999-dev https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • ext-curl *
  • php >=5.6.0

 

The Development Requires

by Avatar PXgamer

api php wrapper devrant

02/11 2017

v1.2.2

1.2.2.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-curl *

 

The Development Requires

api php wrapper devrant

23/10 2017

v1.2.0

1.2.0.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-curl *

 

The Development Requires

api php wrapper devrant

23/10 2017

v1.2.1

1.2.1.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-curl *

 

The Development Requires

api php wrapper devrant

18/09 2017

dev-development

dev-development https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

api php wrapper devrant

25/02 2017

v1.1.1

1.1.1.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

api php wrapper devrant

21/02 2017

v1.1.0

1.1.0.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

api php wrapper devrant

15/02 2017

v1.0.9

1.0.9.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

api php wrapper devrant

14/02 2017

v1.0.8

1.0.8.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

api php wrapper devrant

10/02 2017

v1.0.7

1.0.7.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

api php wrapper devrant

06/02 2017

v1.0.6

1.0.6.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

The Development Requires

by Avatar PXgamer

api php wrapper devrant

23/12 2016

v1.0.5

1.0.5.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant API.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

The Development Requires

by Avatar PXgamer

api php wrapper devrant

23/12 2016

v1.0.4

1.0.4.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant api.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

20/12 2016

v1.0.3

1.0.3.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant api.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

20/12 2016

v1.0.2

1.0.2.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant api.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

12/12 2016

v1.0.1

1.0.1.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant api.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer

09/12 2016

v1.0.0

1.0.0.0 https://github.com/PXgamer/devrant-php

A simple PHP wrapper for utilising the devRant api.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

by Avatar PXgamer