https://github.com/zierhut-it/spotify-ads-php-client
Unofficial PHP Client for the Spotify Ads API
https://github.com/zierhut-it/spotify-ads-php-client
ads api-wrapper client sdk sdk-php spotify
Last synced: 5 months ago
JSON representation
Unofficial PHP Client for the Spotify Ads API
- Host: GitHub
- URL: https://github.com/zierhut-it/spotify-ads-php-client
- Owner: zierhut-it
- License: gpl-3.0
- Archived: true
- Created: 2023-01-31T17:05:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-07T00:16:18.000Z (over 2 years ago)
- Last Synced: 2025-08-12T17:06:26.622Z (10 months ago)
- Topics: ads, api-wrapper, client, sdk, sdk-php, spotify
- Language: PHP
- Homepage:
- Size: 25.4 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Spotify Ads PHP Client
This is an unofficial PHP Client for the [Spotify Marketing API](https://developer.spotify.com/documentation/ads-api/).
[](https://gitHub.com/zierhut-it/spotify-ads-php-client/graphs/commit-activity)
## API Coverage
- [ ] Ad Accounts
- [ ] Advertiser
- [ ] Campaigns
- [ ] Assets
- [x] Reports
- [ ] Targets
- [ ] Ad Sets
- [ ] Ads
- [ ] Estimate
## Installation
Use the package manager [composer](https://getcomposer.org/) to install.
```bash
composer require zierhut-it/spotify-ads-php-client
```
## Getting started
### Authenticate
```PHP
use Spotify\Api\Marketing\Client;
require_once __DIR__ . "/vendor/autoload.php";
$spotify = new Client(
"",
"",
);
// This has to be opened in a browser to grant access
$url = $spotify->auth->getRedirectUrl();
// Save the result for later reuse
$refreshToken = $spotify->auth->getRefreshToken("");
```
### Keep logins
```PHP
// You may set the refresh token again next time, so no new login and callback is needed
$spotify->auth->setRefreshToken("");
```
### Run a report
```PHP
$report = $spotify->newReport();
// You can set options using a simple string
$report->addAdAccountId("");
// Or chain multiple of those
$report
->addDimension("CAMPAIGN")
->addDimension("AD_SET");
// Or don't use chaining
$report->addField("CLICKS");
$report->addField("IMPRESSIONS");
// Or pass multiple values
$report->addField("CTR", "SPEND");
// Or even arrays
$report->addField(["COMPLETION_RATE", "COMPLETES"]);
// When all parameters are set to your liking, make the actual request
$results = $report->run();
// You can use the returned $results or just iterate the report
foreach($report as $row) {
print_r($row);
}
```
## Contributing
Pull requests and Issues are welcome. For major changes, please open an issue first
to discuss what you would like to change.