nickcheek/handwriting

handwriting.io 的 PHP 封装

v1.0.7 2019-12-19 14:00 UTC

This package is auto-updated.

Last update: 2024-09-20 02:52:45 UTC


README

Latest Version on Packagist Quality Score Scrutinizer Code Quality Build Status

这是一个简单的 handwriting.io API PHP 封装。您需要注册一个账户并获取您的访问和密钥。

安装

您可以通过 composer 安装此包

composer require nickcheek/handwriting

使用方法

您可以使用 renderPNGImage()、renderPNGString() 或 renderPDF()

use Nickcheek\Handwriting\Writer;

$handwriting = new Writer($key, $secret);

//get random font
$random = $handwriting->getAllHandwriting(['limit'=> 50,'offset'=>1,'order_dir'=>'asc','order_by'=>'title']);

//build the url
$build = $handwriting->text('Testing the handwriting.io library')
                    ->font($random[array_rand($random)]->id)
                    ->build();

echo $handwriting->renderPNGImage($build);

Render

构建类

构建类允许您以链式方式注入您想要为您的图像设置的参数。

$build = $handwriting->text('text to output')
            ->font($fontID)
            ->height('50px')
            ->width('10px')
            ->size('25px')
            ->lineSpace()
            ->lineSpaceVariance()
            ->wordSpaceVariance()
            ->randomSeed()
            ->color()
            ->build();

如果您需要更多信息,请查看文档

变更日志

请查看变更日志,了解最近发生了哪些变化。

贡献

请查看贡献指南以获取详细信息。

安全性

如果您发现任何与安全性相关的问题,请通过电子邮件 nick@nicholascheek.com 联系,而不是使用问题跟踪器。

致谢

许可协议

MIT 许可协议 (MIT)。有关更多信息,请参阅许可文件