Skip to content

Commit

Permalink
Merge branch 'main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
stcheng authored Jan 26, 2024
2 parents f39fc19 + 4b976a8 commit 39a8587
Show file tree
Hide file tree
Showing 1,680 changed files with 96,910 additions and 15,245 deletions.
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Facebook PHP Business SDK Issue
Since we want to handle bugs more efficiently, we've decided to close issue reporting in Github and move to our dedicated bug reporting channel.
If you encounter a bug with Business SDK (PHP), please report the issue at [our developer bug reporting channel](https://developers.facebook.com/support/bugs/).
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI build
on: [push, pull_request]

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.0', '8.1', '8.2']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{matrix.php-versions}}

- name: Install dependencies
uses: php-actions/composer@v6
with:
php_version: ${{matrix.php-versions}}
dev: yes
args: --prefer-source

- name: PHPUnit Tests
run: vendor/bin/phpunit -v -c test/phpunit-travis.xml --coverage-clover=coverage.clover
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
.DS_Store
/.idea
/builds
arcanist/.phutil_module_cache
# VIM Swap Files #
*.swp
*.swo

30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

156 changes: 156 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Changelog

All notable changes to this project will be documented in this file.


## Unreleased

## v17.0.0


### Added
- `advanced_measurement_table` field to Event for Conversions API.

## v11.0.0


### Changed
- Graph API call upgrade to [v11.0]https://developers.facebook.com/docs/graph-api/changelog/version11.0

## v10.0.1

### Added
- Support for sending multiple values for certain UserData parameters to Conversions API.


## v10.0.0


### Changed
- Graph API call upgrade to [v10.0](https://developers.facebook.com/docs/graph-api/changelog/version10.0)

## v9.0.2


### Added
- `action_source` field to Event for Conversions API.

### Fixed
- `opt_out` field was being removed when set to false for Conversions API.

## v9.0.0
### Changed
- Graph API call upgrade to [v9.0](https://developers.facebook.com/docs/graph-api/changelog/version9.0)

### Added
- `delivery_category` field to Content for Conversions API.

### Changed
- Add empty to the list of reserved keywords.
- Change empty value enum name in AdsPixelFirstPartyCookieStatusValues and AdsPixelDataUseSettingValues

## v8.0.3

### Changed
- Fixed a normalization issue for zero values in CustomData in Conversions API
- Start passing in the appsecret_proof to Conversions API custom http_clients when an appsecret is set
- A Conversions API EventRequest custom http_client must now be an object instead of a class name

## v8.0.2

### Added
- Added batching support to Conversions API. Create batched event requests by using BatchProcessor.

### Added
- `lead_id` field to the Conversions API `user_data` section.
- Added HttpServiceInterface to enable the default request object to be overridden by a user-defined HTTP Request Service class. Can be used to create Conversions API event requests.

## v8.0.1

### Added
- Added async support to Conversions API - Create event request promises by using EventRequestAsync.

## v8.0.0

### Changed
- Graph API call upgrade to [v8.0](https://developers.facebook.com/docs/graph-api/changelog/version8.0)

### Added
- `delivery_category` field in custom_data section for Conversions API(formerly Serverside API).

## v7.0.2
### Added
- Added support for data processing options in Serverside API. For more details see : https://developers.facebook.com/docs/marketing-apis/data-processing-options

## v7.0.0
### Changed
- Graph API call upgrade to [v7.0](https://developers.facebook.com/docs/graph-api/changelog/version7.0)

## v6.0.2
### Added
- Add support for custom properties in the Server-Side API

## v6.0.0
### Changed
- Graph API call upgrade to [v6.0](https://developers.facebook.com/docs/graph-api/changelog/version6.0)

## v5.0.5
### Added
- Server-side API added search_string to CustomData and fixed setLastName in UserData object.

## v5.0.3
### Added
- Added function `getHeaders` in RequestException class which provides header information
### Fixed
- Server Side API CustomData model normalization fix

## v5.0.2

### Added
- Added `CrashRepoter`, more context available [here](https://developers.facebook.com/docs/business-sdk/guides/crash-reports)

## v5.0.1
### Added
- Added strongly typed Server-Side API for Web (https://developers.facebook.com/docs/marketing-api/facebook-pixel/server-side-api/using-the-api)

## v5.0.0
### Changed
- Graph API call upgrade to [v5.0](https://developers.facebook.com/docs/graph-api/changelog/version5.0)

## v4.0.6

### Fixed
- Add back `source` param in `Adaccount->createAdVideo`.

## v4.0.5

### Fixed
- Introduce `addUsersMultiKey` and `removeUsersMultiKey` in `CustomAudience` to still allow add users to `CustomAudience` with multiple keys after `CustomAudienceMultiKey` been deprecated.

## v4.0.0
### Changed
- Graph API call upgrade to [v4.0](https://developers.facebook.com/docs/graph-api/changelog/version4.0)

## v3.3.1
### Changed
- Remove list of API call from Business SDK, any [these APIs](https://developers.facebook.com/docs/graph-api/changelog/4-30-2019-endpoint-deprecations) included in Business SDK will be deprecated.

## v3.3.0
### Changed
- Graph API call upgrade to [v3.3](https://developers.facebook.com/docs/graph-api/changelog/version3.3)
### Deprecated
- Deprecated `parentID` in `AbstractCrudObject`.
- Deprecated `CustomAudienceMultiKey`, use class `CustomAudience` instead.
- Deprecated functions `create`, `read`, `update` in `AbstractCrudObject`. Check out our [recommended way](https://github.com/facebook/facebook-php-business-sdk#object-classes) to make API call.
***`read` will reset the object fields, while `getSelf` will get a new object.*** For example :
```
$async_job = $adaccount->getInsightsAsync($fields, $params);
$async_job = $async_job->getSelf();
while (!$async_job->isComplete()) {
sleep(1);
$async_job = $async_job->getSelf();
}
```

3 changes: 3 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Code of Conduct

Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
45 changes: 45 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributing to Facebook Ads API SDK for PHP
We want to make contributing to this project as easy and transparent as
possible.

## Code of Conduct
The code of conduct is described in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)

## Our Development Process
The Facebook Ads API SDK for PHP is currently developed in Facebook's internal
repositories and then exported out to GitHub by a Facebook team member. We invite
you to submit pull requests directly to GitHub and, after review, these can be
merged into the project.

## Pull Requests
We actively welcome your pull requests.

1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. If you haven't already, complete the Contributor License Agreement ("CLA").

## Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Facebook's open source projects.

Complete your CLA [here](https://code.facebook.com/cla)

## Issues
Since we want to handle bugs more efficiently, we encourage you report bug to
our dedicated bug reporting channel. If you encounter a bug with Business SDK
(PHP), please report the issue at
[our developer bug reporting channel](https://developers.facebook.com/support/bugs/).

Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
disclosure of security bugs. In those cases, please go through the process
outlined on that page

## Coding Style
Please follow [PHP Coding Standards](https://secure.phabricator.com/book/phabcontrib/article/php_coding_standards/)

## License
By contributing to Facebook Ads API SDK for PHP, you agree that your contributions
will be licensed under the LICENSE file in the root directory of this source tree.
14 changes: 7 additions & 7 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ $someObject->{SomeObjectFields::ID} = 123;
$someObject->id = 123;
```

###The Cursor Class
### The Cursor Class
When requesting multiple objects from the Graph, responses may be returned in pages of data which can be traversed using cursors. We encapsulate this information into a `Cursor` class which represents the set of objects in the current page along with information about how to access subsequent pages of objects. This class implements the `\Iterable` and `\Countable` interfaces.

##Reading Objects
## Reading Objects

###Reading a single object
### Reading a single object
To read an object from the Graph you will need its `id`. By default, only the `id` field of an object is queried and you should specify when reading an object the fields you need. It is not recommended that you request all fields unless you require them all.

```php
Expand All @@ -131,7 +131,7 @@ $adaccount = (new AdAccount($id))->read($required_fields);
See [Defining Default Fields](#default_fields) within the section about Extending the SDK for an example of how to avoid defining the fields you require every request.


###Reading multiple objects
### Reading multiple objects
We provide the static method `readIds($ids = array(...), $fields = array(...))` to enable you to request many objects of a single type and will return a `Cursor`:

```php
Expand All @@ -150,7 +150,7 @@ foreach($adaccounts as $account) {
}
```

##Creating Objects
## Creating Objects

When creating objects on the Graph, they are generally created by making a POST request to an edge of a parent object. For example, ads are created using the endpoint `https://graph.facebook.com/act_123123/ads`. Therefore when creating an object, you must know the `id` of the parent object which is generally the id of an AdAccount. You should consult the [Facebook Developer Documentation](https://developers.facebook.com/docs/ads-api) to see which parent object to use.

Expand All @@ -172,7 +172,7 @@ $ad->create(array(
echo $ad->{AdFields::ID};
```

##Updating Objects
## Updating Objects

When you mutate an AdObject, we record which variables have changed and make it easy for you to write these change to the Graph API by calling the `update` method.

Expand Down Expand Up @@ -202,7 +202,7 @@ $ad = new Ad($id);
$ad->delete();
```

###Deleting multiple objects
### Deleting multiple objects

We provide the static method `deleteIds($ids = array(...))` to enable you to delete many objects at the same time. This method returns a boolean value and will only return `true` if all objects were successfully deleted. A return value of `false` means one or more failed to be deleted. Please also note that we do not verify the type of the `id` you have passed into this function.

Expand Down
29 changes: 14 additions & 15 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
Copyright (c) Meta Platforms, Inc. and affiliates.
All rights reserved.

You are hereby granted a non-exclusive, worldwide, royalty-free license to
use, copy, modify, and distribute this software in source code or binary
form for use in connection with the web services and APIs provided by
Facebook.
You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
copy, modify, and distribute this software in source code or binary form for use
in connection with the web services and APIs provided by Facebook.

As with any software that integrates with the Facebook platform, your use
of this software is subject to the Facebook Developer Principles and
Policies [http://developers.facebook.com/policy/]. This copyright notice
shall be included in all copies or substantial portions of the software.
As with any software that integrates with the Facebook platform, your use of
this software is subject to the Facebook Platform Policy
[http://developers.facebook.com/policy/]. This copyright notice shall be
included in all copies or substantial portions of the software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 39a8587

Please sign in to comment.