kladislav / laravel-google-api
Google API Provider for Laravel projects
Installs: 2 659
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
- illuminate/support: ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- league/oauth2-google: ^3.0 || ^4.0
This package is auto-updated.
Last update: 2024-11-17 21:26:24 UTC
README
Install
Require this package with composer using the following command:
composer require kladislav/laravel-google-api
Usage
$youtubeChannelsProvider = new \Kladislav\LaravelGoogleApi\Provider\Youtube\Channels([ 'clientId' => config('services.google.client_id'), 'clientSecret' => config('services.google.client_secret'), ]); $youtubeChannelsProvider->setTokenAndRefreshIfNeeded([ 'access_token' => 'your access token', 'refresh_token' => 'your refresh token', 'expires' => 'time when token expires', ]); $params = [ 'mine' => 'true', 'part' => 'snippet,contentDetails,statistics', ]; $request = $youtubeChannelsProvider->getListRequest($params); $response = $youtubeChannelsProvider->getParsedResponse($request);
Or if you have api key
$youtubeChannelsProvider = new \Kladislav\LaravelGoogleApi\Provider\Youtube\Channels([ 'apiKey' => config('services.google.api_key'), ]);
Pagination
$youtubeChannelsPaginator = new \Kladislav\LaravelGoogleApi\Paginator($youtubeChannelsProvider); foreach($youtubeChannelsPaginator->paginate($youtubeChannelsProvider->getListRequest($params)) as $youtubeChannelsResponse) { foreach($youtubeChannelsResponse['items'] as $item) { dump($item); } }
Available providers
- Google
- Auth
- authorize
- handleAuthorization
- Auth
- Plus
- People
- getUserIdRequest
- People
- Youtube
- Analytics
- getReportsRequest
- Channels
- getListRequest
- ContentID
- getClaimSearchRequest
- getAssetRequest
- getAssetsListRequest
- getContentOwnerListRequest
- getContentOwnerRequest
- I18nLanguages
- getListRequest
- I18nRegions
- getListRequest
- PlaylistItems
- getListRequest
- Playlists
- getListRequest
- Search
- getListRequest
- VideoCategories
- getListRequest
- Videos
- getListRequest
- Analytics
- YoutubeAnalytics
- Jobs
- getListRequest
- Reports
- getListRequest
- ReportTypes
- getListRequest
- Jobs