picr/php-autopilothq
PHP library for interacting with the AutopilotHQ API. Provides an AutopilotManager to manage contacts (get/save/delete/subscribe/unsubscribe, update email), lists (create/find/add/remove/check members), triggers/journeys, and REST hooks.
Pros:
AutopilotManager class encapsulates all API interactions, aligning with Laravel’s service-oriented architecture. This promotes reusability and testability.Cons:
Http client or Guzzle, which may require refactoring for consistency and better error handling.AutopilotContact class, but custom fields or complex data types (e.g., dates, nested objects) may need additional validation or type casting.saveContacts lack optimizations for Laravel’s queue system (e.g., dispatchSync), which could impact performance for large datasets..env or a secrets manager). This increases the risk of hardcoded credentials or improper key rotation.Http client mocks) be used?saveContacts) using Laravel’s queue system or chunking?Http client or Guzzle for better integration, consistency, and features like middleware, retries, and logging.AutopilotManager into Laravel services or controllers via constructor binding to leverage Laravel’s IoC container.contact_lists pivot table) to reduce API calls and improve performance.// app/Models/Contact.php
public function lists() {
return $this->belongsToMany(List::class);
}
ContactUnsubscribed, JourneyStarted) to trigger business logic or notifications.event(new ContactUnsubscribed($contact));
saveContacts, getAllContactsInList) to Laravel’s queue system to avoid timeouts and improve responsiveness.SyncContactsJob::dispatch($contacts)->onQueue('autopilothq');
getContact, saveContact) in a sandbox environment.AutopilotManager with the API key from .env and register any necessary bindings or aliases.
// app/Providers/AutopilotServiceProvider.php
public function register() {
$this->app->singleton(AutopilotManager::class, function ($app) {
return new AutopilotManager(config('services.autopilothq.key'));
});
}
Autopilot::getContact($email)) to simplify usage in controllers and views.Http client or Guzzle for better integration and error handling.syncWithAutopilot()).How can I help you explore Laravel packages today?