Skip to content

Commit

Permalink
Release 60.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrick committed Feb 21, 2023
1 parent 786c924 commit 530d2a1
Show file tree
Hide file tree
Showing 3,540 changed files with 57,776 additions and 425,699 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
### 60.0.0

##### AdWords

* Removed support because [the API was
sunset](https://ads-developers.googleblog.com/2022/04/reminder-requests-to-adwords-api-will.html).
Users should migrate to the new client library
[google-ads-php](https://github.com/googleads/google-ads-php) to access the new
[Google Ads API](https://developers.google.com/google-ads/api/docs/start)
instead.
* Removed all code examples including the `LaravelSampleApp`. Users should refer
to the new set of
[code examples](https://github.com/googleads/google-ads-php/tree/HEAD/examples)
of the new client library to access the new Google Ads API instead which
also includes a `LaravelSampleApp`.

##### Ad Manager

* Added support for v202302.
* Removed support for v202202.
* Removed examples for v202205.

##### Common

* Removed support for version 7.3 of the php dependency.
* Added support for version 3 of the monolog/monolog dependency.
* Added support for version 6 of the symfony/serializer dependency.
* Upgraded the minimum version of the guzzlehttp/psr7 dependency to 1.7 and
added support for version 2.
* Migrated the example Auth/GetRefreshToken from OOB. More details can be found
[here](https://developers.google.com/identity/protocols/oauth2/resources/oob-migration).

### 59.0.0

##### AdWords
Expand Down
9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ patches.
## Submitting Patches

* Sign a Contributor License Agreement (see above).
* Join the appropriate product discussion forum.
* AdWords API: https://developers.google.com/adwords/api/community/
* Ad Manager API: https://developers.google.com/ad-manager/community
* DFA API:
https://developers.google.com/doubleclick-advertisers/reporting/community
* Join the [Google Ad Manager API
forum](https://groups.google.com/g/google-doubleclick-for-publishers-api).
* Join the [Google Ad Manager product
community](https://support.google.com/admanager/community).
* Create an issue on the library issue tracker if there isn't one already. Use
this issue to co-ordinate the changes with the library maintainer.
* Fork the library using `git clone https://github.com/googleads/googleads-php-lib.git`,
Expand Down
182 changes: 51 additions & 131 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
## Google Ads API PHP Client Library

This project hosts the PHP client library for the various SOAP-based Ads APIs
(AdWords and Ad Manager) at Google.
This repository hosts the PHP client library for the Google Ad Manager SOAP API.

> **The AdWords API is [sunsetting](https://ads-developers.googleblog.com/2022/04/reminder-requests-to-adwords-api-will.html).
> **The AdWords API is [sunset](https://ads-developers.googleblog.com/2022/04/reminder-requests-to-adwords-api-will.html).
> You can use the new client library [google-ads-php](https://github.com/googleads/google-ads-php) to access the new [Google Ads API](https://developers.google.com/google-ads/api/docs/start) instead.**
[![PHP version](https://badge.fury.io/ph/googleads%2Fgoogleads-php-lib.svg)](https://badge.fury.io/ph/googleads%2Fgoogleads-php-lib) [![Build Status](https://travis-ci.org/googleads/googleads-php-lib.svg?branch=main)](https://travis-ci.org/googleads/googleads-php-lib)
Expand All @@ -13,8 +12,8 @@ This project hosts the PHP client library for the various SOAP-based Ads APIs
* System requirements and dependencies can be found in `composer.json` of this
library. See [this page](https://getcomposer.org/doc/01-basic-usage.md) for
more details.
* From version 52.0.0, this library requires the minimum PHP version to be
7.3. If you have an older version of PHP, `composer` command will
* From version 60.0.0, this library requires the minimum PHP version to be
7.4. If you have an older version of PHP, `composer` command will
download an older version of the `googleads/googleads-php-lib` library.
* This library depends on [Composer](https://getcomposer.org/). If you don't
have it installed on your computer yet, follow the
Expand All @@ -23,24 +22,17 @@ This project hosts the PHP client library for the various SOAP-based Ads APIs
For the rest of this guide, we're assuming that you're using
Linux/Unix/OS X and have Composer installed [globally](https://getcomposer.org/doc/00-intro.md#globally),
thus, your installed Composer is available on the command line as `composer`.
* To use this library to connect to AdWords API, you need an
[OAuth 2 client ID and secret](https://developers.google.com/adwords/api/docs/guides/first-api-call#oauth2_client_id_and_client_secret),
as well as a [developer token](https://developers.google.com/adwords/api/docs/guides/first-api-call#developer_token).
Make sure you've written down these credentials in advance.

### Getting started

Copy the sample `adsapi_php.ini` for your product to your
Copy the sample [Ad Manager
adsapi_php.ini](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdManager/adsapi_php.ini)
to your
[home directory](https://en.wikipedia.org/wiki/Home_directory#Default_home_directory_per_operating_system)
and fill out the required properties before downloading the library.
This library determines the home directory of your computer by using
[`EnvironmentalVariables::getHome()`](https://github.com/googleads/googleads-php-lib/blob/HEAD/src/Google/AdsApi/Common/Util/EnvironmentalVariables.php#L34).

* [AdWords
adsapi_php.ini](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdWords/adsapi_php.ini)
* [Ad Manager
adsapi_php.ini](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdManager/adsapi_php.ini)

### Downloading this library

There are three ways of downloading this library as described below.
Expand Down Expand Up @@ -95,65 +87,52 @@ this library (e.g., submitting pull requests) or wish to try our examples.
1. Follow [Setting up your OAuth2 credentials](#setting-up-your-oauth2-credentials)
if you haven't set up the credentials yet.
1. You can now use the library and run any examples you want. Try
[GetCampaigns.php](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdWords/v201809/BasicOperations/GetCampaigns.php)
[GetAllNetworks.php](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdManager/v202211/NetworkService/GetAllNetworks.php)
by executing the following command:
```
$ php examples/AdWords/v201806/BasicOperations/GetCampaigns.php
$ php examples/AdManager/v202211/NetworkService/GetAllNetworks.php
```
### Downloading a compressed tarball
This is suitable for those who only want to try out the AdWords API with this
This is suitable for those who only want to try out the Ad Manager API with this
client library. The extracted directory of the tarball will contain only the
`examples/` directory.
1. On the [releases page](https://github.com/googleads/googleads-php-lib/releases),
select a version you want to try. Then, under **Download**, select the tarball
of your choice. The name of the tarball indicates which product it belongs to,
for example, **adwords-examples-vX.Y.Z.tar.gz**.
for example, **admanager-examples-vX.Y.Z.tar.gz**.
1. Extract your downloaded file to any location on your computer.
1. Navigate to the extracted directory (for example, **adwords-examples-vX.Y.Z**).
1. Navigate to the extracted directory (for example, **admanager-examples-vX.Y.Z**).
1. Run `composer install` at the command prompt. This will install all dependencies
needed for using the library and running examples.
1. Follow [Getting started](#getting-started) if you haven't done so.
1. Follow [Setting up your OAuth2 credentials](#setting-up-your-oauth2-credentials)
if you haven't set up the credentials yet.
1. You can now run any examples you want. Try
[GetCampaigns.php](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdWords/v201809/BasicOperations/GetCampaigns.php)
[GetAllNetworks.php](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdManager/v202211/NetworkService/GetAllNetworks.php)
by executing the following command:
```
$ php examples/AdWords/v201806/BasicOperations/GetCampaigns.php
$ php examples/AdManager/v202211/NetworkService/GetAllNetworks.php
```
### Setting up your OAuth2 credentials
The AdWords and Ad Manager APIs use
[OAuth2](https://oauth.net/2/) as the authentication mechanism. Follow the
appropriate guide below based on your use case.
**If you're accessing an API using your own credentials...**
* [Using
AdWords](https://github.com/googleads/googleads-php-lib/wiki/API-access-using-own-credentials-\(installed-application-flow\))
* [Using
Ad Manager](https://github.com/googleads/googleads-php-lib/wiki/API-access-using-own-credentials-\(server-to-server-flow\))
The Ad Manager API uses [OAuth2](https://oauth.net/2/) as the authentication
mechanism. Follow the appropriate guide below based on your use case:
**If you're accessing an API on behalf of clients...**
* [Using AdWords or
Ad Manager](https://github.com/googleads/googleads-php-lib/wiki/API-access-on-behalf-of-your-clients-\(web-flow\))
* [Using your own
credentials](https://github.com/googleads/googleads-php-lib/wiki/API-access-using-own-credentials-\(server-to-server-flow\))
* [Acting on behalf of
clients](https://github.com/googleads/googleads-php-lib/wiki/API-access-on-behalf-of-your-clients-\(web-flow\))
### Basic usage
The best way to learn how to use this library is to review the examples for your
product.
* [AdWords
examples](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdWords)
* [Ad Manager
examples](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdManager)
The best way to learn how to use this library is to review the
[examples](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdManager).
> All our examples are meant to be run via the command line and not through a
> webpage.
Expand All @@ -164,44 +143,24 @@ product.
> when writing your own code, do _not_ apply `intval()` on any attributes that
> are explicitly an integer.
The following snippet of code from the **BasicOperations/GetCampaigns.php**
example for AdWords gives you an idea of how to use this library. The usage
pattern is similar for Ad Manager.
The following snippet of code from the **GetAllNetworks.php** example gives you
an idea of how to use this library.
```php
use Google\AdsApi\AdWords\AdWordsServices;
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
use Google\AdsApi\AdWords\v201802\cm\CampaignService;
use Google\AdsApi\AdWords\v201802\cm\OrderBy;
use Google\AdsApi\AdWords\v201802\cm\Paging;
use Google\AdsApi\AdWords\v201802\cm\Selector;
use Google\AdsApi\Common\OAuth2TokenBuilder;
$oAuth2Credential = (new OAuth2TokenBuilder())
->fromFile()
$oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()
->build();
$session = (new AdWordsSessionBuilder())
->fromFile()
$session = (new AdManagerSessionBuilder())->fromFile()
->withOAuth2Credential($oAuth2Credential)
->build();
$adWordsServices = new AdWordsServices();
$campaignService = $adWordsServices->get($session, CampaignService::class);
$adManagerServices = new ServiceFactory();
// Create selector.
$selector = new Selector();
$selector->setFields(array('Id', 'Name'));
$selector->setOrdering(array(new OrderBy('Name', 'ASCENDING')));
$networkService = $adManagerServices->createNetworkService($session);
// Create paging controls.
$selector->setPaging(new Paging(0, 100));
$networks = $networkService->getAllNetworks();
// Make the get request.
$page = $campaignService->get($selector);
// Do something with the $page.
// Do something with the $networks.
```

The builder's `fromFile()` method looks for an `adsapi_php.ini` file in your
Expand All @@ -217,40 +176,18 @@ don't want to or can't use one, you can use the OAuth2 token and ads session
builders instead to set the same information. See the builders for details:

* [OAuth2TokenBuilder](https://github.com/googleads/googleads-php-lib/blob/HEAD/src/Google/AdsApi/Common/OAuth2TokenBuilder.php)
* [AdWordsSessionBuilder](https://github.com/googleads/googleads-php-lib/blob/HEAD/src/Google/AdsApi/AdWords/AdWordsSessionBuilder.php)
* [AdManagerSessionBuilder](https://github.com/googleads/googleads-php-lib/blob/HEAD/src/Google/AdsApi/AdManager/AdManagerSessionBuilder.php)

### WSDL objects with names that are reserved PHP keywords

#### Class names

Note that some WSDL object types have names that are reserved PHP keywords and
need to be augmented when used as PHP class names. The following is a list of
these occurences.

* [Function](https://developers.google.com/adwords/api/docs/reference/latest/CampaignFeedService.Function)
=> `MatchingFunction`
* [Parent](https://developers.google.com/adwords/api/docs/reference/latest/AdGroupCriterionService.Parent)
=> `ParentCriterion`

#### Constant names

Some WSDL enum values have names that are reserved PHP keywords and need to be
modified when used as PHP constant names. For example, `AND` and `DEFAULT` are
generated as `AND_VALUE` and `DEFAULT_VALUE`.

### Logging

This library conforms to [PSR-3](http://www.php-fig.org/psr/psr-3) for logging
and provides the following loggers:

AdWords

* SOAP logger
* Report downloader logger
* Batch jobs utility logger

Ad Manager
and provides the following loggers for Ad Manager:

* SOAP logger
* Report downloader logger
Expand Down Expand Up @@ -285,10 +222,10 @@ soapLogLevel = "NOTICE"
If you need to further customize logging, you can specify your own logger
entirely by providing a logger that implements
[LoggerInterface](https://github.com/php-fig/log/blob/master/Psr/Log/LoggerInterface.php)
in either the AdWords or Ad Manager session builders:
in the Ad Manager session builder:

```php
$session = (new AdWordsSessionBuilder())
$session = (new AdManagerSessionBuilder())
...
->withSoapLogger(new MyCustomSoapLogger())
->withReportDownloaderLogger(new MyCustomReportDownloaderLogger())
Expand All @@ -297,13 +234,10 @@ $session = (new AdWordsSessionBuilder())

### Utilities

We provide some utilities in this client library for helping you use features
in the AdWords and Ad Manager API more conveniently. Check out the following wikis for
details:

* [BatchJobs for AdWords](//github.com/googleads/googleads-php-lib/wiki/BatchJobs-for-AdWords)
* [ProductPartitions for AdWords](//github.com/googleads/googleads-php-lib/wiki/ProductPartitions-for-AdWords)
* [ReportDownloader Utilities](//github.com/googleads/googleads-php-lib/wiki/ReportDownloader-Utilities)
We provide some
[utilities](//github.com/googleads/googleads-php-lib/wiki/ReportDownloader-Utilities)
in this client library for helping you use features in the Ad Manager API more
conveniently.

### Reporting

Expand Down Expand Up @@ -344,9 +278,9 @@ CA file issues can also cause an error like this:
```
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL:
Couldn't load from
'https://adwords.google.com/api/adwords/cm/v201806/CampaignService?wsdl' :
'https://ads.google.com/apis/ads/publisher/v202211/ActivityService?wsdl' :
failed to load external entity
"https://adwords.google.com/api/adwords/cm/v201806/CampaignService?wsdl
"https://ads.google.com/apis/ads/publisher/v202211/ActivityService?wsdl
```

To remedy, see [Steps for troubleshooting CA file issues](https://github.com/googleads/googleads-php-lib/wiki/Steps-for-troubleshooting-CA-file-issues).
Expand All @@ -355,17 +289,11 @@ To remedy, see [Steps for troubleshooting CA file issues](https://github.com/goo

PHPDoc for this library can be found in the
[gh-pages](https://github.com/googleads/googleads-php-lib/tree/gh-pages) branch
of this repository and can be viewed at:

* [AdWords](http://googleads.github.io/googleads-php-lib/AdWords/)
* [Ad Manager](http://googleads.github.io/googleads-php-lib/AdManager/)
of this repository. You can view the Ad Manager API site
[here](http://googleads.github.io/googleads-php-lib/AdManager/).

General AdWords and Ad Manager API documentation can be found on our Google Developers
site:

* [AdWords API documentation](https://developers.google.com/adwords/api)
* [Ad Manager API
documentation](https://developers.google.com/ad-manager)
General Ad Manager API documentation can be found on our [Google Developers
site](https://developers.google.com/ad-manager).

### Coding Style

Expand All @@ -389,22 +317,14 @@ For client library specific bug reports, feature requests, and patches,
create an issue on the [issue
tracker](https://github.com/googleads/googleads-php-lib/issues).

For general AdWords and Ad Manager API questions, bug reports, or feature requests,
post to our forums:

* [AdWords API Forum](https://groups.google.com/forum/#!forum/adwords-api)
* [Ad Manager API
Forum](https://groups.google.com/forum/#!forum/google-doubleclick-for-publishers-api)
For general Ad Manager API questions, bug reports, or feature requests, post to
the [Ad Manager API
Forum](https://groups.google.com/forum/#!forum/google-doubleclick-for-publishers-api).

### Announcements and updates

For general ads API and client library updates and news, follow:

* [Google Ads Developers blog](http://googleadsdeveloper.blogspot.com)
* [Ad Manager API Sunset Announcements mailing
list](https://groups.google.com/forum/#!forum/dfpapi-sunset-announce)

API deprecation schedules can be found at:

* [Ad Manager API deprecation
schedule](https://developers.google.com/ad-manager/docs/deprecation)
For general Ad Manager API and client library updates and news, you can follow
the [Sunset Announcements mailing
list](https://groups.google.com/forum/#!forum/dfpapi-sunset-announce)
and rely on the [deprecation
schedule](https://developers.google.com/ad-manager/docs/deprecation).
Loading

0 comments on commit 530d2a1

Please sign in to comment.