coliving/laravel-reddit-api

Laravel Reddit API 封装器

0.1.8 2022-04-04 08:12 UTC

This package is not auto-updated.

Last update: 2024-09-16 19:05:40 UTC


README

使用此包可以轻松从 Reddit API 获取数据。

Laravel 封装 https://github.com/rotorcowboy/Phapper

支持 Laravel 5.x, 6.x, 7.x, 8.x, 9.x

以下是一些提供的方法示例

use RedditAPI;

//fetch top Reddit posts
RedditAPI::getTop();

//fetch top picture posts of Margot Robbie, limit to 100
RedditAPI::search('Margot Robbie ', null, 'top', null, 'pics', 100);

安装

此包可以通过 Composer 安装。

composer require coliving/laravel-reddit-api

您必须安装此服务提供者。

// config/app.php
'providers' => [
    ...
    CodeWizz\RedditAPI\RedditAPIServiceProvider::class,
    ...
];

此包还包括一个外观,它提供了一种调用类的方法。

// config/app.php
'aliases' => [
    ...
    'RedditAPI' => CodeWizz\RedditAPI\RedditAPIFacade::class,
    ...
];

您可以使用以下命令发布此包的配置文件

php artisan vendor:publish --provider="CodeWizz\RedditAPI\RedditAPIServiceProvider"

以下配置文件将发布到 config/reddit-api.php

return [
    'endpoint_standard' => 'https://www.reddit.com',
    'endpoint_oauth' => 'https://oauth.reddit.com',

    'username' => '',
    'password' => '',
    'app_id' => '',
    'app_secret' => '',

    'response_format' => 'STD', // STD | ARRAY

    'scopes' => 'save,modposts,identity,edit,flair,history,modconfig,modflair,modlog,modposts,modwiki,mysubreddits,privatemessages,read,report,submit,subscribe,vote,wikiedit,wikiread'
];

关于 CodeWizz

CodeWizz 是一家位于立陶宛的网页开发公司。您可以在我们的网站上找到更多信息 https://codewizz.com

许可证

MIT 许可证(MIT)。请参阅 许可证文件 获取更多信息。