sigwin / reddit-client
Reddit.com API
Installs: 2 058
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.0
- sigwin/infra: ~1.5.0
This package is auto-updated.
Last update: 2025-02-17 20:04:26 UTC
README
Reddit.com API
For more information, please visit https://ssl.reddit.com/dev/api.
Installation & Usage
Requirements
PHP 7.4 and later. Should also work with PHP 8.0.
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
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.1.0
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen