{"id":13718432,"url":"https://github.com/owenvoke/devrant-php","last_synced_at":"2025-04-14T13:22:55.366Z","repository":{"id":57046113,"uuid":"74596644","full_name":"owenvoke/devrant-php","owner":"owenvoke","description":"A simple PHP wrapper for utilising the devRant api.","archived":false,"fork":false,"pushed_at":"2017-12-06T14:20:55.000Z","size":55,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T02:38:26.761Z","etag":null,"topics":["api","devrant","php-wrapper"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/pxgamer/devrant-php","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/owenvoke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-23T16:52:35.000Z","updated_at":"2022-03-05T09:12:31.000Z","dependencies_parsed_at":"2022-08-24T03:40:28.959Z","dependency_job_id":null,"html_url":"https://github.com/owenvoke/devrant-php","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenvoke%2Fdevrant-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenvoke%2Fdevrant-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenvoke%2Fdevrant-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenvoke%2Fdevrant-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/owenvoke","download_url":"https://codeload.github.com/owenvoke/devrant-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248886728,"owners_count":21177736,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","devrant","php-wrapper"],"created_at":"2024-08-03T01:00:27.287Z","updated_at":"2025-04-14T13:22:55.339Z","avatar_url":"https://github.com/owenvoke.png","language":"PHP","readme":"# devrant-php\n\n[![Build Status](https://travis-ci.org/pxgamer/devrant-php.svg?branch=master)](https://travis-ci.org/pxgamer/devrant-php)\n\nA simple PHP wrapper for utilising the [devRant](https://devrant.com) api.\n\n## Usage\n\n__Include the class:__\n- Using Composer\n\n`composer require pxgamer/devrant-php`\n```php\n\u003c?php\nrequire 'vendor/autoload.php';\n```\n\n- Including the files manually\n```php\n\u003c?php\ninclude 'src/Connection.php';\ninclude 'src/Rant.php';\n```\n\nOnce included, you can initialise the class using either of the following:\n```php\n$devRant = new \\pxgamer\\devRant\\Connection();\n```\n```php\nuse \\pxgamer\\devRant\\Connection;\n$devRant = new Connection();\n```\n\n## Class Methods\n\nMethod Name           | Parameters | Returns\n--------------------- | ---------- | -------\ngetRants($searchterm) | string (optional) | `array of Rant objects`\ngetRantById($id)      | int        | `Rant object`\ngetUserById($id)      | int        | `array`\ngetUsersId($username) | string     | `array`\nlogin($username, $password) | strings     | `boolean`\nlogout()              | void       | `void`\nrant($rant) | Rant object | `array`\ncomment($rantId, $comment) | mixed | `array`\nvoteRant($rantId, $vote) | mixed | `array`\nvoteComment($commentId, $vote) | mixed | `array`\nnotifs() | void | `array`\ncollabs() | void | `array`\ndeleteRant($rantId) | int | `array`\ndeleteComment($commentId) | int | `array`\ndeleteAccount() | void | `array`\n\n## Examples\n\n### _Getting array of rants_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\n$devRant-\u003egetRants(); // Get rants\n$devRant-\u003egetRants($searchterm); // Get rants using a search query\n```\nReturns false on failure, or:\n```php\n[\n    0 =\u003e Rant object,\n    1 =\u003e Rant object,\n    ...\n]\n```\n\n### _Getting a single rant by its id_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\n$devRant-\u003egetRantById(int);\n```\nReturns false on failure, or a `Rant` object.\n\n### _Getting a user by their id_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\n$devRant-\u003egetUserById(int);\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true,\n    \"profile\" =\u003e [\n        \"username\" =\u003e \"\",\n        \"score\" =\u003e 0,\n        \"about\" =\u003e \"\",\n        \"location\" =\u003e \"\",\n        \"created_time\" =\u003e 1474613872,\n        \"skills\" =\u003e \"\",\n        \"github\" =\u003e \"\",\n        \"website\" =\u003e \"\",\n        \"content\" =\u003e [\n            \"content\" =\u003e [\n                \"rants\" =\u003e [],\n                \"upvoted\" =\u003e [],\n                \"comments\" =\u003e [],\n                \"favorites\" =\u003e []\n            [,\n            \"counts\" =\u003e []\n        ],\n        \"avatar\" =\u003e []\n    ]\n]\n```\n\n### _Search rants_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\n$devRant-\u003egetRants('string');\n```\nReturns false on failure, or:\n```php\n[\n    0 =\u003e Rant object [\n        \"id\" =\u003e 0,\n        \"text\" =\u003e \"string\",\n        \"num_upvotes\" =\u003e 0,\n        \"num_downvotes\" =\u003e 0,\n        \"score\" =\u003e 0,\n        \"created_time\" =\u003e 0,\n        \"attached_image\" =\u003e [\n            \"url\" =\u003e \"string\",\n            \"width\" =\u003e 0,\n            \"height\" =\u003e 0\n        ],\n        \"num_comments\" =\u003e 0,\n        \"tags\" =\u003e [\n            \"string\"\n        ],\n        \"vote_state\" =\u003e 0,\n        \"edited\" =\u003e false,\n        \"user_id\" =\u003e 0,\n        \"user_username\" =\u003e \"string\",\n        \"user_score\" =\u003e 0,\n        \"user_avatar\" =\u003e [\n            \"b\" =\u003e \"string\"\n        ]\n    ],\n    1 =\u003e Rant object,\n    ...\n]\n```\n\n### _Getting a user's id from their username_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\n$devRant-\u003egetUserId('username');\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true,\n    \"user_id\" =\u003e 0\n]\n```\n\n### _Getting signed in_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\n$devRant-\u003elogin('username', 'password');\n```\nReturns `true` if successful, `false` if not\n\n### _Posting a rant_\n```php\nuse \\pxgamer\\devRant\\Rant;\n\n$devRant = new \\pxgamer\\devRant\\Connection;\nif ($devRant-\u003elogin('username', 'password')) {\n    $devRant-\u003erant(new Rant($rant_content, $tags));\n}\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true,\n    \"rant_id\" =\u003e 31131\n]\n```\n\n### _Posting a comment_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\nif ($devRant-\u003elogin('username', 'password')) {\n    $devRant-\u003ecomment($rantId, 'Comment Content');\n}\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true\n]\n```\n\n### _Getting Collabs_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\n\n$collabs = $devRant-\u003ecollabs();\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true,\n    \"rants\" =\u003e [\n\t\t[0] =\u003e [\n\t\t    ...\n\t\t]\n\t]\n]\n```\n\n### _Voting on Rants_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\nif ($devRant-\u003elogin('username', 'password')) {\n    $voteRant = $devRant-\u003evoteRant($rantId, $vote);\n}\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true,\n    \"rant\" =\u003e [\n\t\t[id] =\u003e ...,\n\t\t...\n\t]\n]\n```\n\n### _Voting on Comments_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\nif ($devRant-\u003elogin('username', 'password')) {\n    $voteRant = $devRant-\u003evoteComment($commentId, $vote);\n}\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true,\n    \"comment\" =\u003e [\n\t\t[id] =\u003e ...,\n\t\t...\n\t]\n]\n```\n\n### _Getting your notifications_\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\nif ($devRant-\u003elogin('username', 'password')) {\n    $notifications = $devRant-\u003enotifs();\n}\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true,\n    \"data\" =\u003e {\n\t\t\"items\" =\u003e [\n\t\t\t...\n\t\t],\n\t\t\"check_time\" =\u003e 11111,\n\t\t\"username_map\" =\u003e {\n\t\t\t...\n\t\t}\n\t}\n]\n```\n\n### _Deleting a rant_\n\n*Please note that this will __permanently__ delete the rant from devRant.*\n\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\nif ($devRant-\u003elogin('username', 'password')) {\n    $devRant-\u003edeleteRant($rantId);\n}\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true\n]\n```\n\n### _Deleting a comment_\n\n*Please note that this will __permanently__ delete the comment from devRant.*\n\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\nif ($devRant-\u003elogin('username', 'password')) {\n    $devRant-\u003edeleteComment($commentId);\n}\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true\n]\n```\n\n### _Deleting your account_\n\n*Please note that this will __permanently__ delete your account from devRant.*\n\n```php\n$devRant = new \\pxgamer\\devRant\\Connection;\nif ($devRant-\u003elogin('username', 'password')) {\n    $devRant-\u003edeleteAccount();\n}\n```\nReturns:\n```php\n[\n    \"success\" =\u003e true\n]\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowenvoke%2Fdevrant-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowenvoke%2Fdevrant-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowenvoke%2Fdevrant-php/lists"}