目录
Yin Liu

Fix unautoloadable FacebookAds classes in capi-param-builder (PSR-4 violation breaking php-business-sdk)

Summary: GitHub issue facebook/capi-param-builder#36: FacebookAds\PII_DATA_TYPE is not autoloadable in 1.3.1, which breaks facebook/php-business-sdk 25.0.2 — UserData::normalize() calls FacebookAds\PII_DATA_TYPE::EMAIL, and any server-side Conversions API event fatals with Class "FacebookAds\PII_DATA_TYPE" not found.

Root cause: the package’s only autoload rule is psr-4: { "FacebookAds\\": "src/" }, but PII_DATA_TYPE (and in fact all 15 classes under src/model/, src/util/, src/piiUtil/) declare the flat namespace FacebookAds; while living in subdirectories. Under PSR-4, FacebookAds\PII_DATA_TYPE must resolve to src/PII_DATA_TYPE.php; Composer never looks in src/model/Constants.php, so class_exists('FacebookAds\PII_DATA_TYPE') returns false. The package itself only works today via manual require_once chains, but a downstream consumer that references the class through Composer autoloading (like the SDK) fatals.

Fix: add a classmap autoload entry for the three subdirectories alongside the existing PSR-4 map. Composer’s classmap maps a class to its file by scanning declarations regardless of filename or directory, so FacebookAds\PII_DATA_TYPE and the other 14 subdirectory classes become autoloadable while every fully-qualified class name stays exactly as-is (important: the SDK depends on the flat FacebookAds\PII_DATA_TYPE FQN, so renaming/re-namespacing is not an option). This is the maintainer-suggested fix from the issue and requires no file moves or namespace changes. Also bumped the package version 1.3.1 -> 1.3.2 so the fix ships as a new release.


Differential Revision: D112249764

fbshipit-source-id: 7f5b758a5f93683daa182bc1fd7aecfec869233e

10天前326次提交

Conversions API parameter builder: SDK to help improve Conversions API param quality

Introduction

Conversions API parameter builder SDK is a lightweight tool for improving Conversions API parameter retrieval and quality. The SDK helps ensure event parameters adhere to best practices.

Parameter builder supports 5 server-side languages and 1 clientside language:

  • Server-side: PHP, Java, NodeJS, Python and Ruby.
  • Client-side: JavaScript.

Check Parameter Builder Library Overview for more details. In each languages’ subfolder, we provide quick start guide and examples.

Latest Versions

Language Version Package Registry
PHP 1.3.1 facebook/capi-param-builder-php Packagist
NodeJS 1.3.1 capi-param-builder-nodejs npm
Python 1.3.0 capi-param-builder-python PyPI
Java 1.3.0 com.facebook.capi.sdk:capi-param-builder Maven Central
Ruby 1.3.0 capi_param_builder_ruby RubyGems
Client JS 1.3.1 meta-capi-param-builder-clientjs npm

License

Conversions API parameter builder SDKs are licensed under the LICENSE file in the root directory of this source tree.

邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号