定制 escopecz/mautic-form-submit 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

escopecz/mautic-form-submit

最新稳定版本:2.0.0-alpha

Composer 安装命令:

composer require escopecz/mautic-form-submit

包简介

A library for submitting Mautic form from a 3rd pary PHP app

关键字:

README 文档

README

Scrutinizer Code Quality Build Status Code Coverage

Submitting a form can get handy if you want to process the data with your app, but you want to send them to Mautic too. Mautic can then run automated tasks triggered by the form submission. Read more about it in the original post.

Since the new Mautic versions prefer cookie tracking over IP tracking which makes more tedious to submit the form as the tracked contact, this library will take care of the cookie sending via CURL. It will also listen the cookie from the response and updates the contact cookie with the values from the submit response. This way if the contact ID changes because of contact merge, the contact will continue browsing under the new contact ID.

The automatic cookie handling requires that your form will be on a page tracked by the Mautic JS tracking which provides the Mautic contact cookie in the first place.

Install

Via Composer

composer require escopecz/mautic-form-submit

Usage

// Require Composer autoloader
require __DIR__.'/vendor/autoload.php';

// Define the namespace of the Mautic object
use Escopecz\MauticFormSubmit\Mautic;

// Define the namespace of the Mautic configuration object
use Escopecz\MauticFormSubmit\Mautic\Config;

// It's optional to declare the configuration object to change some default values.
// For example to disable Curl verbose logging.
$config = new Config;
$config->setCurlVerbose(true);

// Instantiate the Mautic object with the base URL where the Mautic runs
$mautic = new Mautic('https://mymautic.com');

// Create a new instance of the Form object with the form ID 342
$form = $mautic->getForm(342);

// Submit provided data array to the form 342
$result = $form->submit(['f_email' => 'john@doe.email']);
  • The integer passed to the getForm() method must be ID of the Mautic form.
  • The array passed to the submit() method must be associative array of ['mautic_field_alias' => 'the_value'].

For working example see the examples dir.

Run project

ddev start 

Project url: https://mautic-form-submit.ddev.site/

Testing

composer test
composer cs
composer phpstan

Current status

Travis Scrutinizer

License

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

统计信息

  • 总下载量: 26.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 59
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 58
  • Watchers: 10
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-04-25