Skip to content

PHP library is not PSR-4 compliant, autoloading doesn't work #33

Description

@rootpd

The composer.json currently states this:

  "autoload": {
    "psr-4": {
      "FacebookAds\\": "php/capi-param-builder/src/"
    }
  },

Similarly, the composer.json within php/capi-param-builder/php states this:

  "autoload": {
    "psr-4": {
      "FacebookAds\\": "src/"
    }

The issue is with the classes within the subfolders of the PHP package (model, piiUtil, util) which all use FacebookAds namespace. The PSR-4 autoloading won't match them. Any attempt to use one of these classes ends up with straight PHP error, for example:

Class "FacebookAds\PII_DATA_TYPE" not found

Because of this, our conversion tracking is failing. The Business SDK library is using it exactly this way and fails: https://github.com/facebook/facebook-php-business-sdk/blob/main/src/FacebookAds/Object/ServerSide/UserData.php#L936

Please verify the correctness of autoloading and either update composer.json files, or move files out of their subfolders so they match PSR-4 standard.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions