mtcextendee/mautic-badge-generator-bundle
Composer 安装命令:
composer require mtcextendee/mautic-badge-generator-bundle
包简介
README 文档
README
Plugin from Mautic Extension family (https://mtcextendee.com)
Download 7 ultimate free Mautic email themes https://mtcextendee.com/themes/
In general, plugin modify any PDF and add new text custom slots and barcode to PDF. Useful for your events.
Features
- Add with custom text slots to PDF
- Custom contact fields
- Custom font-size, color and position
- Add barcode to PDF
- Require https://github.com/mtcextendee/mautic-barcode-generator-bundle
- Any custom contact field to generate Barcode
- Custom position and width/height of barcode
- Add QRcode to PDF
- Require https://github.com/mtcextendee/mautic-barcode-generator-bundle
- Any custom contact field to generate QRcode
- Custom position and width/height of barcode, color etc.
- Token support - use link to badge in email/page (
{badge=1}) - Add to stage after download generate PDF
- Generate custom PDF for each contacts from contact list
- Display badge generator bundle just for contact with certain tags
Installation
Installation from command line:
composer require mtcextendee/mautic-badge-generator-bundlephp app/console mautic:plugins:reload
Manual installation is not allowed because plugins depend on another setasign/fpdi-tcpdf, which is installed automatically from command line.
Setup
Just go to plugins and enable new BadgeGenerator integration. Then you should see new column in left menu.
Generate PDF
In contact list
Before
After
API
Library: https://github.com/mautic/api-library
Hook
$api = new \Mautic\Api\Api($auth, $apiUrl); $contactId = 1; $badgeId = 2; $response = $api->makeRequest(sprintf("badge/generator/%d/%d", $contactId, $badgeId));
Example for Basic Authorization:
// Bootup the Composer autoloader include __DIR__.'/vendor/autoload.php'; use Mautic\Auth\ApiAuth; $apiUrl = 'http://mautic.site'; $settings = [ 'userName' => 'admin', 'password' => 'mautic', ]; $initAuth = new ApiAuth(); $auth = $initAuth->newAuth($settings, 'BasicAuth'); $api = new \Mautic\Api\Api($auth, $apiUrl); $contactId = 1; $badgeId = 2; $response = $api->makeRequest(sprintf("badge/generator/%d/%d", $contactId, $badgeId)); if (isset($response['pdf'])) { $result = base64_decode($response['pdf']); // Write on file file_put_contents('test.pdf', $result); echo 'PDF created'; } elseif (isset($response['errors'][0]['message'])) { echo $response['errors'][0]['message']; }
Response:
- If badge exist for contact
$response['pdf'] = 'base64 encode of PDF content';
You need base64decode of PDF content and then process it (dispay or save..). For more info check: https://selectpdf.com/web-html-to-pdf-rest-api-for-php-samples/
- If badge or contact not exist:
$response['errors']
mtcextendee/mautic-badge-generator-bundle 适用场景与选型建议
mtcextendee/mautic-badge-generator-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 66 次下载、GitHub Stars 达 11, 最近一次更新时间为 2019 年 03 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mtcextendee/mautic-badge-generator-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mtcextendee/mautic-badge-generator-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 66
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2019-03-18



