定制 baraja-core/mjml-php-server 二次开发

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

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

baraja-core/mjml-php-server

最新稳定版本:v1.2.1

Composer 安装命令:

composer require baraja-core/mjml-php-server

包简介

Render your MJML template on custom PHP server.

README 文档

README

Integrity check

Imagine you want render your MJML template on your private PHP server, now you can.

Please note: This package is not officially supported as of 2021-04-01. Install MJML manually on the server, or use Docker.

How to install

Install this package by Composer or download manually:

composer require baraja-core/mjml-php-server

Your server must use PHP 7.1 or better and installed MJML by Node modules (internal command is /node_modules/.bin/mjml).

Server configuration

Your server must support the shell_exec() function and Apache or Ngnix.

In your root directory of webserver please configure calling this internal logic. For instance this way (most simply solution):

<?php

require __DIR__ . '/src/MjmlServer.php'; // Path to this package

$cacheDir = __DIR__ . '/cache'; // Or can be null

(new \Baraja\Mjml\MjmlServer($cacheDir))->run();

Now your MJML server is configured.

When you call URI /api/v1/mjml by HTTP request on your domain, you can render your MJML template.

API usage

API must be called by POST method with body parameter template with template.

Final template will be returned by json response.

Some example:

Call URI /api/v1/mjml with parameter:

MJML API Response example

Minimal template configuration:

<mjml>
    <mj-body>
        <mj-section>
            <mj-column>
                <mj-text>Hello World</mj-text>
            </mj-column>
        </mj-section>
    </mj-body>
</mjml>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2020-05-05