- How do I install facebook/php-business-sdk in a Laravel app?
- Install it with composer require facebook/php-business-sdk. It requires PHP 8.0 or newer and uses PSR-4 autoloading, so there are no exotic runtime requirements. There is no service provider to register, so you can use it directly after Composer autoloading is in place. Check your composer.lock for transitive dependencies before merging into a Laravel 10 or 11 project.
- Is facebook/php-business-sdk a Laravel package with a service provider or facade?
- No. It is a vendor SDK, not a Laravel package, and it ships with no service provider, publishable config, facade, or Laravel-native HTTP transport. Its entry point is the static Api::init() and Api::instance() singleton that wraps a Session and a cURL-based client. It will sit beside Laravel rather than inside it unless you write a thin adapter layer.
- How do I test facebook/php-business-sdk calls with Laravel Http::fake()?
- You cannot rely on Laravel's Http::fake() hooks because the SDK uses its own cURL-based FacebookAds\Http\Client rather than Guzzle. Laravel's HTTP middleware and retry policy also do not apply automatically. To make it testable, wrap the SDK behind your own interface and inject a fake or stub transport in tests. Keep the adapter small so the rest of your application depends on your abstraction, not the SDK singleton.
- How do I handle Api::init() singleton state in Laravel queues and Octane?
- The SDK's Api::instance() holds global state, which is a correctness hazard in queue workers, Laravel Octane, and multi-tenant agency scenarios. Token leakage across tenants is a realistic failure if you initialize once and reuse it globally. Wrap initialization in an adapter that sets the correct token per tenant or job, and avoid sharing the singleton across requests or workers. Treat every write path as something that must be queued and isolated.
- Does facebook/php-business-sdk support Laravel 10, Laravel 11, and PHP 8.1?
- Yes, the SDK's PHP 8.0 floor is compatible with Laravel 10 and 11 on PHP 8.1 and newer. There are no expected conflicts, but you should verify the transitive dependency footprint in composer.lock before merge. Compatibility is fine; the real work is building a testable adapter, config surface, logging, retries, and queued writes around it.
- How do I add retries and backoff to Meta Marketing API calls in Laravel?
- The SDK does not pick up Laravel's retry policy because its HTTP layer is bespoke rather than Guzzle-based. Add retry and backoff in your adapter around SDK calls, and queue every write path so failures can be retried safely. Combine that with structured logging so you can see rate limits, transient errors, and token problems. A bounded adapter sprint of roughly three to five days covers this work for an experienced Laravel developer.
- What license does facebook/php-business-sdk use, and is it safe for commercial Laravel apps?
- It uses the Facebook Platform license, not MIT or Apache, and package metadata reports NOASSERTION. Legal and security teams should review the platform terms and patent clauses before shipping it in a commercial product. Also confirm sign-off on Meta's Business Tools Terms if you handle advertising data. Do not assume permissive open-source licensing just because it is on Packagist.
- How often does facebook/php-business-sdk need updating for Graph API versions?
- The SDK is autogenerated from Meta's codegen repository and tracks Graph API versions on a roughly quarterly cadence, with about two-year deprecation windows. Field and parameter deprecations are a recurring, non-optional maintenance load. Decide which Graph API version you target and assign an owner for the quarterly upgrade ritual. Budget for this as ongoing maintenance rather than a one-time integration cost.
- Do I need Meta app review and ads_management permission to use the Marketing API?
- Yes. Permissions such as ads_management and related Marketing API access require Meta app review with screencasts and business verification, which typically takes weeks. App review is the critical path and gates every code milestone after the read-only spike. You can prototype read-only reporting first, but plan the review timeline before committing to write access or campaign creation features.
- How do I build a multi-tenant Meta Ads integration in Laravel with per-account tokens?
- Do not rely on the SDK singleton for multi-tenant or agency use. Build a thin adapter that initializes the SDK per tenant with the correct token, and prefer a Business Manager system-user token strategy over user tokens with refresh handling. Queue all write paths and add structured logging, retry, and backoff around the transport. Whether you support one advertiser token or many ad accounts changes the entire adapter design, so settle that before coding.