Package Data | |
---|---|
Maintainer Username: | julles |
Maintainer Contact: | reza.wikrama3@gmail.com (Muhamad Reza Abdul Rohim) |
Package Create Date: | 2016-01-15 |
Package Last Update: | 2016-11-11 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-01-30 03:09:15 |
Package Statistics | |
---|---|
Total Downloads: | 1,097 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 24 |
Total Watchers: | 6 |
Total Forks: | 13 |
Total Open Issues: | 0 |
Package Instagram untuk Laravel 5
Tambahkan Package pada composer.json
composer require muhamadrezaar/instagram
setelah package terdownload , register provider dan facade nya
Provider :
Oblagio\Instagram\InstagramServiceProvider::class,
Facade :
'IG' => Oblagio\Instagram\InstagramFacade::class,
Publish config
php artisan vendor:publish
Buka file config/InstagramConfig.php masukan user id dan access token instagram anda contoh :
<?php
/* NOTES
* Jika hanya menampilkan data pribadi saja , cukup masukan userId dan accesToken
* Jika diperlukan autentikasi login semua nya wajib di isi
*/
return [
'userId' => 'user-id-kamu',
'accessToken' => 'access-token-kamu',
'clientId' => 'client-id-kamu',
'clientSecret' => 'client-secrets-kamu',
'redirectUri' => 'redirect-uri-kamu',
];
Menampilkan Gambar low resolusi
<?php
foreach(IG::lowResolution() as $row)
{
echo "<img src = '".$row."' />";
}
?>
Contoh Output Menampilkan gambar low resolution di browser
Menampilkan Gambar standar resolusi
<?php
foreach(IG::standardResolution() as $row)
{
echo "<img src = '".$row."' />";
}
?>
Menampilkan Informasi User
<?php
echo IG::username();
echo IG::bio();
echo IG::website();
echo IG::pic();
echo IG::fullName();
echo IG::countFollowers();
echo IG::countFollowing();
?>
Menampilkan Data Followers
<?php
foreach(IG::displayFollowers() as $row)
{
echo $row['full_name'];
echo $row['profile_picture'];
echo $row['username'];
echo $row['id'];
}
?>
Menampilkan Data Following
<?php
foreach(IG::displayFollowing() as $row)
{
echo $row['full_name'];
echo $row['profile_picture'];
echo $row['username'];
echo $row['id'];
}
?>
contoh membuat link authentikasi (tombol login ke instagram)
<?php
echo "<a href = '".IG::getCodeAuth()."'>Login</a>";
?>
tombol diatas akan meredirect ke halaman login instagram , setelah si user login maka instagram akan meridirect ke halaman yang anda declare di InstagramConfig.php -> ('redirectUri' => 'bla bla bla').
contoh redirectUri : localhost:8000/instagram
selain meredirect ke halaman url anda tadi , instagram memberikan code di url anda , ini url nya localhost:8000/instagram?code=1234567. nah di url ini lah kita bisa mendapatkan informasi si user yang login tadi , dengan cara meggunakan script berikut :
<?php
$ig = IG::auth($_GET['code']);
print_r($ig);
?>
semua informasi user yang login bisa di dapatkan :).
email aja ke : reza.wikrama3@gmail.com
https://reza.mit-license.org/
ENJOY !!!