Git Product home page Git Product logo

shanbay-for-laravel5's Introduction

扇贝网的API封装

作为一个少壮不努力,老大背单词的人来说,我很喜欢使用扇贝单词,然后也会经常往里面写笔记,时间一长了,想着如果我想把扇贝单词的笔记备份一下呢? 于是就有了这个包。😝

安装

composer require cong5/shanbay

配置

找到 config/app.php 里面的 providers 数组, 加上一行 cong5\shanbay\ShanbayServiceProvider::class

发布配置文件

执行 php artisan vendor:publish

使用

//实例化
$shanbay = new Shanbay($app_key, $app_secret, $redirect_uri); 
//获取授权Web URL
$authUrl = $shanbay->getAuthUrl();
//拿到code后,使用code获取
$accessToken = $shanbay->getAccessToken($code);
//拿到AccessToken后,重新获取Shanbay实例
$shanbay = new Shanbay($app_key, $app_secret, $redirect_uri,$accessToken); 

函数列表

 //笔记
$shanbay->getNote();//获取笔记
$shanbay->createNote();//创建笔记
$shanbay->deleteNote();//删除笔记
$shanbay->favoritesNote();//收藏笔记
//例句
$shanbay->getExample();//获取例句
$shanbay->createExample();//添加例句
$shanbay->favoritesExample();//收藏例句
$shanbay->deleteExample();//删除例句
//用户
$shanbay->getUserInfo();//获取用户信息
//单词
$shanbay->searchWord();//查询单词
$shanbay->addWord();//添加单词
$shanbay->forgetWord();//忘记单词

私有API调用

私有API调用是扇贝未开放的API,调用方式使用模拟登陆后进行调用

//实例化
$shanbay = new PrivateShanbay();
//模拟登陆
$shanbay->login();
//获取每日单词学习状态
$shanbay->getState();
//获取打卡记录
$shanbay->getLastCheckIn();

LICENSE

MIT

shanbay-for-laravel5's People

Contributors

cong5 avatar

Watchers

James Cloos avatar opensmarty avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.