facebook / facebook-php-business-sdk

PHP SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
836 stars 518 forks source link

Fatal error: Class 'FacebookAds\Object\AdCampaign' not found in /Users/jordan #164

Closed jtgui12 closed 8 years ago

jtgui12 commented 8 years ago

Hello Everyone,

Can someone help me on this ? I have a problem to get simple analytics of my campaigns. I receive this message: Fatal error: Class 'FacebookAds\Object\AdCampaign' not found in /Users/jordan

And my php code is: <?php include 'vendor/autoload.php'; // Add to header of your file use FacebookAds\Api; use FacebookAds\Object\AdAccount; use FacebookAds\Object\AdUser; use FacebookAds\Object\Campaign; use FacebookAds\Object\Fields\CampaignFields; use FacebookAds\Object\Values\AdObjectives; use FacebookAds\Object\AdSet; use FacebookAds\Object\Fields\AdSetFields; use FacebookAds\Object\Fields\TargetingSpecsFields; use FacebookAds\Object\TargetingSpecs; use FacebookAds\Object\Values\OptimizationGoals; use FacebookAds\Object\Values\PageTypes; use FacebookAds\Object\Values\BillingEvents; use FacebookAds\Object\Values\InsightsLevels; use FacebookAds\Object\AdCampaign; use FacebookAds\Object\Values\InsightsPresets; use FacebookAds\Object\Fields\InsightsFields; // Add after echo "You are logged in " $accesstoken = '**'; $app_id = '1525006754476982'; $clientsecret = '*******'; Api::init($app_id, $client_secret, $access_token); $campaign = new AdCampaign('6033258891498'); $campaign->read(array( CampaignFields::ID, CampaignFields::NAME, CampaignFields::OBJECTIVE, )); $params = array( 'time_range' => array( 'since' => '2015-12-01', 'until' => '2015-12-13', ), ); $fields = array( InsightsFields::IMPRESSIONS, InsightsFields::UNIQUE_CLICKS, InsightsFields::REACH, ); $insights = $campaign->getInsights($fields, $params); print_r($insights);

Please can you help me on this? Many thanks!!!

duliomatos commented 8 years ago

Hey @jtgui12, this seems to be a setup issue rather than a bug. Can you check your installation and composer settings making sure you're following our README? https://github.com/facebook/facebook-php-ads-sdk

vantaiit commented 7 years ago

Me too . I dont see any class AdCampaign

vitaltheatre commented 1 year ago

pnordh commented on Sep 6, 2017 The AdCampaign class was renamed in https://github.com/facebook/facebook-php-business-sdk/commit/225ed62295a203c3ce30b7be3f6eb890eced3f90 to Campaign in order to be consistent with the endpoints.