shahrukhkhan / instagram
此包为您提供与Instagram API通信的便捷方式
dev-master
2017-07-24 16:46 UTC
Requires
- php: >=5.6.4
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2024-09-20 01:03:48 UTC
README
这是一个简单的包,为您提供所有可以在一个地方访问的Instagram API。在编写此包时,我已安装了php7.0,但也可以使用php5.6运行,只需更改guzzle版本即可。
安装
composer require shahrukhkhan/instagram
或者在您的composer.json文件的要求部分添加以下内容:
"require": {
"shahrukhkhan/instagram": "dev-master"
}
要求
- Instagram应用
- Instagram客户端ID
- Instagram客户端密钥
- 从https://developers.google.com/maps/web/获取的Google Maps API密钥
一旦您获得了Instagram客户端ID,将其放置在您的.env文件中,如下所示:
- INSTAGRAM_CLIENT_ID=
- INSTAGRAM_REDIRECT_URI=
- INSTAGRAM_CLIENT_SECRET=
- GOOGLE_MAPS_KEY=
完成后,通过Instagram::functionName($params)访问函数
函数
要使用此包进行认证,请从您的路由中调用auth()函数,您可以将多个作用域作为数组提及
Route::get('instagram-auth', function(){ return redirect()->away(\Shahrukh\Instagram\Instagram::auth($scopes)); });
可用函数列表
exchangeCodeForToken() // expects the code you received while authenticating, and gives you access token in return getSelf() // gives information about logged in user getSelfMedia() // gives media list of logged in user getFollowedBy() // expects access token and user id(default is self), return the list of users who follows the user in question getFollows() // expects access token and user id(default is self), return the list of users, user in question follows getFollowRequest() // expects access token and user id (default is self), return the follow requests user in quesiton received getRelationship() // expects access token and user id, get information about a relationship of logged in user with mentioned user id changeRelationship() //expects access token and user id, modify the relationship between the current user and the target user. getMedia() // expects access token and media id, get information about a media object. searchMedia() //expects access token, area and distance (default distance is 1000 mtrs), searches for recent media in a given area.