sigwin / reddit-client
Reddit.com API
Installs: 2 226
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/sigwin/reddit-client
Requires
- php: ^8.2
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^2.0
Requires (Dev)
- phpunit/phpunit: ^12.1.0
- sigwin/infra: ~1.16.0
README
Reddit.com API
For more information, please visit https://ssl.reddit.com/dev/api.
Installation & Usage
Requirements
PHP 8.1 and later.
Composer
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/sigwin/reddit-client.git"
}
],
"require": {
"sigwin/reddit-client": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php:
<?php require_once('/path/to/RedditClient/vendor/autoload.php');
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: oauth2 $config = Sigwin\RedditClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Sigwin\RedditClient\Api\ThingApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = t3_11e9mr5; // string $sr_name = pics; // string try { $result = $apiInstance->getInfo($id, $sr_name); print_r($result); } catch (Exception $e) { echo 'Exception when calling ThingApi->getInfo: ', $e->getMessage(), PHP_EOL; }
API Endpoints
All URIs are relative to https://oauth.reddit.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| ThingApi | getInfo | GET /api/info | Get thing info |
| UserApi | getAbout | GET /user/{username}/about | Returns the identity of a user. |
| UserApi | getSaved | GET /user/{username}/saved | Get user saved things |
| UserApi | me | GET /api/me | Returns the identity of the current user. |
Models
Authorization
Authentication schemes defined for the API:
oauth2
- Type:
OAuth - Flow:
accessCode - Authorization URL:
/authorize - Scopes: N/A
Tests
To run the tests, use:
composer install vendor/bin/phpunit
Author
About this package
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
1.2.0- Generator version:
7.13.0-SNAPSHOT
- Generator version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen