PHP code example of pxgamer / devrant-php

1. Go to this page and download the library: Download pxgamer/devrant-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pxgamer / devrant-php example snippets





de 'src/Rant.php';

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

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

$devRant = new \pxgamer\devRant\Connection;
$devRant->getRants(); // Get rants
$devRant->getRants($searchterm); // Get rants using a search query

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

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

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

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

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

[
    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,
    ...
]

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

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

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

use \pxgamer\devRant\Rant;

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

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

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

[
    "success" => true
]

$devRant = new \pxgamer\devRant\Connection;

$collabs = $devRant->collabs();

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

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

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

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

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

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

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

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

[
    "success" => true
]

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

[
    "success" => true
]

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

[
    "success" => true
]