/convertkit

Send new subscribe to ConvertKit

Primary LanguagePHPMIT LicenseMIT

ConvertKit @EbrahimPLeite

Maintainer Source Code PHP from Packagist Latest Version Software License Total Downloads

Class responsible for communicating with ConvertKit

Installation

Composer:

composer require ebrahimpleite/convertkit

Documentation

For details on how to use class, see the example folder with details in the component directory

<?php
require __DIR__ . "/../vendor/autoload.php";

$api_key = '';
$convertkit = new \EbrahimPLeite\ConvertKit\ConvertKit($api_key);

$subscribe = $convertkit->addSubscribe(
    "123", //required (form_id)
    "email@example.com", //required (email)
    "Ebrahim", //required (first_name)
    [123, 1234], //optional array separate tags ids with commas (tags)
    "P. Leite" //optional (last_name)
);
var_dump($subscribe);
Success response
object(stdClass)#4 (1){
   [
      "subscription"
   ]=> object(stdClass)#2 (8){
      [
         "id"
      ]=> int(2899486245)[
         "state"
      ]=> string(6)"active"[
         "created_at"
      ]=> string(24)"2020-12-26T02:10:41.000Z"[
         "source"
      ]=> string(43)"API::V3::SubscriptionsController (external)"[
         "referrer"
      ]"=> NULL"[
         "subscribable_id"
      ]=> int(1890238)[
         "subscribable_type"
      ]=> string(4)"form"[
         "subscriber"
      ]=> object(stdClass)#3 (1){
         [
            "id"
         ]=> int(1116010157)
      }
   }
}

Contributing

Please see CONTRIBUTING for details.

Thank you

License

The MIT License (MIT). Please see License File for more information.