承接 papajin/activecampaign-api-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

papajin/activecampaign-api-php

Composer 安装命令:

composer require papajin/activecampaign-api-php

包简介

This is unofficial PHP wrapper for the ActiveCampaign API v3. For the time being we start with Contact entity only.

README 文档

README

Source Code Latest Version Software License

About

This is unofficial PHP wrapper for the ActiveCampaign API v3. For the time being we start with Contact entity only.

Installation

The preferred method of installation is via Packagist and Composer. Run the following command to install the package and add it as a requirement to your project's composer.json:

composer require papajin/activecampaign-api-php

Requirements

The library uses Guzzle library for http calls. Version ~6.0 is stable version for the moment. The PHP version (5.6.38) is used in our environment (due to some legacy code restrictions). The package was also working OK with PHP version 7.2. Operation of the package with other PHP versions not tested.

Examples

Please, refer to the API docs for the parameters and responses structure.

<?php
require 'vendor/autoload.php';

use papajin\ActiveCampaign\AC\Contact;
use \GuzzleHttp\Exception\ClientException;


const AC_API_PROJECT = 'https://account.api-us1.com';
const AC_API_KEY = 'somelongstringherewithyourkey';

$ac_contact = Contact::instance( AC_API_PROJECT, AC_API_KEY );

/* OR $contact = Contact::instance(  new \GuzzleHttp\Client( $options ) ); */

$id = 7;

try {

    // Get data for contact with id 7
    $response_body = $ac_contact->show( $id );

    $contact = $response_body->contact;

    $geoIps = $response_body->geoIps; // ...and so on.
    
    // Create contact
    $data = [
        "email"     => "john_doe@gmail.com",
        "firstName" => "John",
        "lastName"  => "Doe",
    ];
    
    $response_body = $ac_contact->create( $data );

} catch ( ClientException $e ) {

    // Something wrong on the service side
    if( 404 == $e->getCode() )
        echo 'Not found exception: ' . $e->getMessage() . PHP_EOL;
    elseif ( 403 == $e->getCode() )
        echo 'Check that valid token provided: ' . $e->getMessage() . PHP_EOL;

}
catch ( RuntimeException $e ) {
 
     // Something wrong on your side
     echo 'Caught exception: ' . $e->getMessage() . PHP_EOL;
 
 }

统计信息

  • 总下载量: 90
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固