PHP code example of revolution / laravel-google-photos
1. Go to this page and download the library: Download revolution/laravel-google-photos library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
revolution / laravel-google-photos example snippets
// Command or etc
use App\Models\User;
use Illuminate\Support\Facades\Storage;
use Revolution\Google\Photos\Facades\Photos;
Photos::withToken(User::find(1)->refresh_token);
with(Photos::upload(Storage::get('test.png'), 'test.png'), function (string $token) {
Photos::batchCreate([$token]);
});
use Revolution\Google\Photos\Facades\Photos;
$album = Photos::withToken('token')->updateAlbumTitle($albumId, $newTitle);
use Revolution\Google\Photos\Facades\Photos;
use Google\ApiCore\PagedListResponse;
$items = Photos::withToken('token')->listMediaItems();
foreach ($items as $item){
dump($item->getBaseUrl());
}
use Google\Photos\Library\V1\PhotosLibraryResourceFactory;
use Revolution\Google\Photos\Facades\Photos;
$newAlbum = Photos::withToken('token')->createAlbum(PhotosLibraryResourceFactory::album('title'));
dump($newAlbum->getId());
dump($newAlbum->getTitle());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.