Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 23 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,49 @@
# Data Manager API Utility Library and Samples for PHP
# Data Manager API utility library and samples for PHP

[![Packagist Version](https://img.shields.io/packagist/v/googleads/data-manager-util.svg)](https://packagist.org/packages/googleads/data-manager-util)

Utility library and code samples for working with the
[Data Manager API](https://developers.google.com/data-manager/api) and PHP.

## Requirements

* PHP 8.2+

## Documentation

Please refer to our [Developer
Site](https://developers.google.com/data-manager/api/get-started/set-up-access#php)
for documentation on how to install, configure, and use the client library.
- PHP 8.2+

## Add dependencies to your project
## Setup instructions

To use the utility library in your PHP project, install it using [Composer](https://getcomposer.org/):
The `googleads/data-manager-util` utility library is published to
[Packagist](https://packagist.org/packages/googleads/data-manager-util). Install
it using [Composer](https://getcomposer.org/):

```shell
composer require googleads/data-manager-util
```

### Quickstart

```php
use Google\Ads\DataManagerUtil\Formatter;
use Google\Ads\DataManagerUtil\Encoding;

$formatter = new Formatter();

// Format, normalize, hash (SHA-256), and hex-encode an email address:
$email = $formatter->processEmailAddress('User.Name@gmail.com', Encoding::Hex);

// Format, normalize, hash (SHA-256), and hex-encode a phone number:
$phone = $formatter->processPhoneNumber('+1 (800) 555-0100', Encoding::Hex);
```
For complete instructions on setting up API access and installing the client and
utility libraries, see the
[Set up API access](https://developers.google.com/data-manager/api/devguides/quickstart/set-up-access)
and
[Install a client library](https://developers.google.com/data-manager/api/devguides/quickstart/install-library#php)
guides.

## Repository structure

- [`src/`](src/): Source code for the `googleads/data-manager-util` library.
Follow the instructions above to declare a dependency on `googleads/data-manager-util`
in your project. Use the utilities in the library to help with common tasks like
formatting, normalizing, hashing, and encoding data for Data Manager API requests.
- [`src/`](src/): Source code for the `googleads/data-manager-util` Packagist
package. Use the utilities in the library to help with common tasks like
formatting, normalizing, hashing, and encoding data for Data Manager API
requests.

- [`samples/`](samples/): Code samples demonstrating how to construct and send
requests to the Data Manager API using the API client library (`googleads/data-manager`)
and the utility library.

## Usage

The `samples/audiences` directory contains example scripts demonstrating how to
ingest audience members.

* `ingest_audience_members.php`: Shows how to ingest audience members without
encryption.

Before running the samples, ensure you have set up your Google Cloud project,
enabled the necessary APIs, and configured authentication (e.g., Application
Default Credentials).
requests to the Data Manager API using the
[`googleads/data-manager`](https://packagist.org/packages/googleads/data-manager)
client library and the `googleads/data-manager-util` utility library.

## Run samples

To run a sample, invoke the script using the command line. You can pass
arguments to the script in one of two ways:

### 1. Explicitly, on the command line
### 1. Explicitly, on the command line

```shell
php samples/events/ingest_events.php \
Expand All @@ -74,7 +53,7 @@ php samples/events/ingest_events.php \
--json_file='</path/to/your/file>'
```

### 2. Using an arguments file
### 2. Using an arguments file

You can also save arguments in a file.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ads",
"utilities"
],
"homepage": "https://developers.google.com/data-manager",
"homepage": "https://developers.google.com/data-manager/api",
"license": "Apache-2.0",
"support": {
"issues": "https://github.com/googleads/data-manager-php/issues",
Expand Down
Loading