{"id":19176884,"url":"https://github.com/googleads/googleads-php-lib","last_synced_at":"2025-05-13T00:34:04.808Z","repository":{"id":37858067,"uuid":"15348522","full_name":"googleads/googleads-php-lib","owner":"googleads","description":"Google Ad Manager SOAP API Client Library for PHP","archived":false,"fork":false,"pushed_at":"2025-02-20T17:44:56.000Z","size":57379,"stargazers_count":663,"open_issues_count":7,"forks_count":767,"subscribers_count":94,"default_branch":"main","last_synced_at":"2025-04-23T18:53:58.861Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/googleads.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-20T21:23:39.000Z","updated_at":"2025-04-08T14:31:40.000Z","dependencies_parsed_at":"2023-01-21T12:00:16.401Z","dependency_job_id":"9fe61de6-8bb8-4db1-8d63-6d3ff0f5a9dd","html_url":"https://github.com/googleads/googleads-php-lib","commit_stats":{"total_commits":273,"total_committers":48,"mean_commits":5.6875,"dds":0.8351648351648352,"last_synced_commit":"0fef4e320d04ccb3189e4b0626af97ba2f17a924"},"previous_names":[],"tags_count":108,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleads%2Fgoogleads-php-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleads%2Fgoogleads-php-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleads%2Fgoogleads-php-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleads%2Fgoogleads-php-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googleads","download_url":"https://codeload.github.com/googleads/googleads-php-lib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253850294,"owners_count":21973661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T10:30:55.804Z","updated_at":"2025-05-13T00:34:04.779Z","avatar_url":"https://github.com/googleads.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Google Ad Manager SOAP API Client Library for PHP\n\nThis repository hosts the PHP client library for the Google Ad Manager SOAP API.\n\n\u003e **The AdWords API is [sunset](https://ads-developers.googleblog.com/2022/04/reminder-requests-to-adwords-api-will.html).\n\u003e 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.**\n\n[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg)](https://www.php.net/supported-versions.php)\n[![Latest Stable\nVersion](https://img.shields.io/packagist/v/googleads/googleads-php-lib.svg)](https://packagist.org/packages/googleads/googleads-php-lib)\n[![Total Downloads](https://poser.pugx.org/googleads/googleads-php-lib/downloads.svg)](https://packagist.org/packages/googleads/googleads-php-lib)\n[![License](https://poser.pugx.org/googleads/googleads-php-lib/license.svg)](https://packagist.org/packages/googleads/googleads-php-lib)\n\n**IMPORTANT** This client library has been updated to require PHP version 8.0 as the minimum version, as announced in [#777](https://github.com/googleads/googleads-php-lib/issues/777).\nThis means that the final version of the library that supports PHP 7 is [v61.0.0](https://github.com/googleads/googleads-php-lib/releases/tag/v61.0.0), which supports Google Ad Manager API v202208, v202211, v202302, and v202305.\n\nGoogle Ad Manager API v202305 is [scheduled to be sunset in May 2024](https://developers.google.com/ad-manager/api/deprecation). Therefore, PHP 7 users have about a year to migrate to the version 8.0 or higher of PHP to avoid disruption.\n\n### Requirements and Preparation\n\n*   System requirements and dependencies can be found in `composer.json` of this\n    library. See [this page](https://getcomposer.org/doc/01-basic-usage.md) for\n    more details.\n*   From version 62.0.0, this library requires the minimum PHP version to be\n    8.0. If you have an older version of PHP, `composer` command will\n    download an older version of the `googleads/googleads-php-lib` library.\n*   This library depends on [Composer](https://getcomposer.org/). If you don't\n    have it installed on your computer yet, follow the\n    [installation guide for Linux/Unix/OS X](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx)\n    or [installation guide for Windows](https://getcomposer.org/doc/00-intro.md#installation-windows).\n    For the rest of this guide, we're assuming that you're using\n    Linux/Unix/OS X and have Composer installed [globally](https://getcomposer.org/doc/00-intro.md#globally),\n    thus, your installed Composer is available on the command line as `composer`.\n\n### Getting started\n\nCopy the sample [Ad Manager\nadsapi_php.ini](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdManager/adsapi_php.ini)\nto your\n[home directory](https://en.wikipedia.org/wiki/Home_directory#Default_home_directory_per_operating_system)\nand fill out the required properties before downloading the library.\nThis library determines the home directory of your computer by using\n[`EnvironmentalVariables::getHome()`](https://github.com/googleads/googleads-php-lib/blob/HEAD/src/Google/AdsApi/Common/Util/EnvironmentalVariables.php#L34).\n\n### Downloading this library\n\nThere are three ways of downloading this library as described below.\n\n| Method                                                                | Target Users                                                                                                                  |\n|-----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| [Using `composer require`](#using-composer-require)                   | Those who want to **use this library as a third-party library** for their projects and thus example files are not needed.     |\n| [Using `git clone`](#using-git-clone)                                 | Those who want to **alter or contribute to this library** (e.g., submitting a pull request) or want to **run example files**. |\n| [Downloading a compressed tarball](#downloading-a-compressed-tarball) | Those who only want to **run example files**.                                                                                 |\n\n#### Note\n\n*   If you don't have OAuth2 credentials prior to using\n    [installed application flow](https://github.com/googleads/googleads-php-lib/wiki/API-access-using-own-credentials-(installed-application-flow)),\n    you'll need [examples/Auth/GetRefreshToken.php](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/Auth/GetRefreshToken.php).\n    In this case, using `composer require` is not an option since there are no\n    example files downloaded with the library.\n*   **Our examples are meant to be run from the command line and not as a\n    webpage.** If you run them as a webpage, results may not be shown\n    properly.\n\n### Using composer require\n\nThe steps below download this library as a third-party library for your projects.\nThe library will be downloaded by Composer and stored under the `vendor/` directory.\n**Examples are NOT downloaded by this download method.**\n\n1.  Install the latest version using [Composer](https://getcomposer.org/).\n\n    ```\n    $ composer require googleads/googleads-php-lib\n    ```\n\n2.  Follow [Getting started](#getting-started) if you haven't done so.\n3.  Follow [Setting up your OAuth2 credentials](#setting-up-your-oauth2-credentials)\n    if you haven't set up the credentials yet.\n4.  You can now use the library.\n\n### Using git clone\n\nThis method is suitable for those who want to alter or contribute to\nthis library (e.g., submitting pull requests) or wish to try our examples.\n**All** files in this repository will be downloaded.\n\n1.  Run `git clone https://github.com/googleads/googleads-php-lib.git` at\n    the command prompt.\n1.  You'll get a **googleads-php-lib** directory. Navigate to it by running\n    `cd googleads-php-lib`.\n1.  Run `composer install` at the command prompt. This will install all\n    dependencies needed for using the library and running examples.\n1.  Follow [Getting started](#getting-started) if you haven't done so.\n1.  Follow [Setting up your OAuth2 credentials](#setting-up-your-oauth2-credentials)\n    if you haven't set up the credentials yet.\n1.  You can now use the library and run any examples you want. Try\n    [GetAllNetworks.php](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdManager/v202211/NetworkService/GetAllNetworks.php)\n    by executing the following command:\n\n    ```\n    $ php examples/AdManager/v202211/NetworkService/GetAllNetworks.php\n    ```\n\n### Downloading a compressed tarball\n\nThis is suitable for those who only want to try out the Ad Manager API with this\nclient library. The extracted directory of the tarball will contain only the\n`examples/` directory.\n\n1.  On the [releases page](https://github.com/googleads/googleads-php-lib/releases),\n    select a version you want to try. Then, under **Download**, select the tarball\n    of your choice. The name of the tarball indicates which product it belongs to,\n    for example, **admanager-examples-vX.Y.Z.tar.gz**.\n1.  Extract your downloaded file to any location on your computer.\n1.  Navigate to the extracted directory (for example, **admanager-examples-vX.Y.Z**).\n1.  Run `composer install` at the command prompt. This will install all dependencies\n    needed for using the library and running examples.\n1.  Follow [Getting started](#getting-started) if you haven't done so.\n1.  Follow [Setting up your OAuth2 credentials](#setting-up-your-oauth2-credentials)\n    if you haven't set up the credentials yet.\n1.  You can now run any examples you want. Try\n    [GetAllNetworks.php](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdManager/v202211/NetworkService/GetAllNetworks.php)\n    by executing the following command:\n\n    ```\n    $ php examples/AdManager/v202211/NetworkService/GetAllNetworks.php\n    ```\n\n### Setting up your OAuth2 credentials\n\nThe Ad Manager API uses [OAuth2](https://oauth.net/2/) as the authentication\nmechanism. Follow the appropriate guide below based on your use case:\n\n*   [Using your own\n    credentials](https://github.com/googleads/googleads-php-lib/wiki/API-access-using-own-credentials-\\(server-to-server-flow\\))\n*   [Acting on behalf of\n    clients](https://github.com/googleads/googleads-php-lib/wiki/API-access-on-behalf-of-your-clients-\\(web-flow\\))\n\n### Basic usage\n\nThe best way to learn how to use this library is to review the\n[examples](https://github.com/googleads/googleads-php-lib/blob/HEAD/examples/AdManager).\n\n\u003e All our examples are meant to be run via the command line and not through a\n\u003e webpage.\n\u003e\n\u003e If you're using 32-bit PHP, you'll need to change all instances of `intval()`\n\u003e to `floatval()` before running an example. This is due to some IDs exceeding\n\u003e the 32-bit `PHP_INT_MAX` that `intval()` changes your value to. In addition,\n\u003e when writing your own code, do _not_ apply `intval()` on any attributes that\n\u003e are explicitly an integer.\n\nThe following snippet of code from the **GetAllNetworks.php** example gives you\nan idea of how to use this library.\n\n```php\n$oAuth2Credential = (new OAuth2TokenBuilder())-\u003efromFile()\n    -\u003ebuild();\n\n$session = (new AdManagerSessionBuilder())-\u003efromFile()\n    -\u003ewithOAuth2Credential($oAuth2Credential)\n    -\u003ebuild();\n\n$adManagerServices = new ServiceFactory();\n\n$networkService = $adManagerServices-\u003ecreateNetworkService($session);\n\n$networks = $networkService-\u003egetAllNetworks();\n\n// Do something with the $networks.\n```\n\nThe builder's `fromFile()` method looks for an `adsapi_php.ini` file in your\nhome directory by default. If you want to store this file in another directory,\npass the path of the file as an argument. For example:\n\n```\nfromFile('/config/myprops.ini')\n```\n\nIt is highly recommended that you use an `adsapi_php.ini` file. However, if you\ndon't want to or can't use one, you can use the OAuth2 token and ads session\nbuilders instead to set the same information. See the builders for details:\n\n*   [OAuth2TokenBuilder](https://github.com/googleads/googleads-php-lib/blob/HEAD/src/Google/AdsApi/Common/OAuth2TokenBuilder.php)\n*   [AdManagerSessionBuilder](https://github.com/googleads/googleads-php-lib/blob/HEAD/src/Google/AdsApi/AdManager/AdManagerSessionBuilder.php)\n\n### WSDL objects with names that are reserved PHP keywords\n\nSome WSDL enum values have names that are reserved PHP keywords and need to be\nmodified when used as PHP constant names. For example, `AND` and `DEFAULT` are\ngenerated as `AND_VALUE` and `DEFAULT_VALUE`.\n\n### Logging\n\nThis library conforms to [PSR-3](http://www.php-fig.org/psr/psr-3) for logging\nand provides the following loggers for Ad Manager:\n\n*   SOAP logger\n*   Report downloader logger\n\nIn general, each logger logs a summary and debug message for events (e.g., a\nSOAP API call). The\n[level](http://www.php-fig.org/psr/psr-3/#5-psr-log-loglevel) at which messages\nare logged depends on whether the event succeeded.\n\nLog message \\ Event status         | Success | Failure\n---------------------------------- | ------- | -------\nOne-line summary                   | INFO    | WARNING\nDebug message (e.g., SOAP payload) | DEBUG   | NOTICE\n\n#### Configuring logging\n\nBy default, each of the library loggers logs to\n[`STDERR`](http://php.net/manual/en/features.commandline.io-streams.php) on a\nseparate channel using a [Monolog\nStreamHandler](https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/StreamHandler.php).\n\nYou can configure some options for these default loggers in the `adsapi_php.ini`\nfile:\n\n```ini\n[LOGGING]\n; Optional logging settings.\nsoapLogFilePath = \"path/to/your/soap.log\"\nsoapLogLevel = \"NOTICE\"\n```\n\nIf you need to further customize logging, you can specify your own logger\nentirely by providing a logger that implements\n[LoggerInterface](https://github.com/php-fig/log/blob/master/Psr/Log/LoggerInterface.php)\nin the Ad Manager session builder:\n\n```php\n$session = (new AdManagerSessionBuilder())\n    ...\n    -\u003ewithSoapLogger(new MyCustomSoapLogger())\n    -\u003ewithReportDownloaderLogger(new MyCustomReportDownloaderLogger())\n    -\u003ebuild();\n```\n\n### Utilities\n\nWe provide some\n[utilities](//github.com/googleads/googleads-php-lib/wiki/ReportDownloader-Utilities)\nin this client library for helping you use features in the Ad Manager API more\nconveniently.\n\n### Reporting\n\nWhen downloading reports, you can set additional [stream context\noptions](http://php.net/manual/en/context.php) using the `stream_context` key to\nsuit your needs (e.g., increasing the timeout as shown below). See also [Guzzle\nFAQ](http://docs.guzzlephp.org/en/latest/faq.html#how-can-i-add-custom-stream-context-options)\nfor details.\n\n```php\n$options = [\n    'stream_context' =\u003e [\n        'http' =\u003e ['timeout' =\u003e 120]\n    ]\n];\n$requestOptionsFactory = new RequestOptionsFactory($session, $options);\n$reportDownloader = new ReportDownloader($session, $requestOptionsFactory);\n```\n\n### SSL CA files\n\nPHP automatically sets\n[`verify_peer`](http://php.net/manual/en/context.ssl.php) to `true` and will do\nits best to find the most appropriate CA bundle on your system by default.\nHowever, not all systems have a known CA bundle on disk (e.g. Windows). This\nlibrary tries to locate CA bundles on your system by using Guzzle\n[`default_ca_bundle()`](https://github.com/guzzle/guzzle/blob/6.0.2/src/functions.php#L157).\n\nIf this library can't find a CA bundle on your system, you'll get an error\nmessage similar to this:\n\n```\ncURL error 60: SSL certificate problem: unable to get local issuer certificate.\n```\n\nCA file issues can also cause an error like this:\n\n```\nFatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL:\nCouldn't load from\n'https://ads.google.com/apis/ads/publisher/v202211/ActivityService?wsdl' :\nfailed to load external entity\n\"https://ads.google.com/apis/ads/publisher/v202211/ActivityService?wsdl\n```\n\nTo remedy, see [Steps for troubleshooting CA file issues](https://github.com/googleads/googleads-php-lib/wiki/Steps-for-troubleshooting-CA-file-issues).\n\n### Documentation\n\nPHPDoc for this library can be found in the\n[gh-pages](https://github.com/googleads/googleads-php-lib/tree/gh-pages) branch\nof this repository. You can view the Ad Manager API site\n[here](http://googleads.github.io/googleads-php-lib/AdManager/).\n\nGeneral Ad Manager API documentation can be found on our [Google Developers\nsite](https://developers.google.com/ad-manager).\n\n### Coding Style\n\nWe use PSR-2 as a coding style standard. Assuming that you're at the root\ndirectory of your project, to check for coding style violations,\nrun\n\n```\nvendor/bin/phpcs src --standard=phpcs_ruleset.xml -np\n```\n\nTo automatically fix (fixable) coding style violations, run\n\n```\nvendor/bin/phpcbf src --standard=phpcs_ruleset.xml\n```\n\n### Getting support\n\nFor client library specific bug reports, feature requests, and patches,\ncreate an issue on the [issue\ntracker](https://github.com/googleads/googleads-php-lib/issues).\n\nFor general Ad Manager API questions, bug reports, or feature requests, post to\nthe [Ad Manager API\nForum](https://groups.google.com/forum/#!forum/google-doubleclick-for-publishers-api).\n\n### Announcements and updates\n\nFor general Ad Manager API and client library updates and news, you can follow\nthe [Sunset Announcements mailing\nlist](https://groups.google.com/forum/#!forum/dfpapi-sunset-announce)\nand rely on the [deprecation\nschedule](https://developers.google.com/ad-manager/docs/deprecation).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogleads%2Fgoogleads-php-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogleads%2Fgoogleads-php-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogleads%2Fgoogleads-php-lib/lists"}