nickcheek/handwriting

PHP Wrapper for handwriting.io

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

This package is auto-updated.

Last update: 2024-05-20 02:06:06 UTC


README

Latest Version on Packagist Quality Score Scrutinizer Code Quality Build Status

This is a simple php wrapper for the handwriting.io api. You'll need to register for an account and get your access and secret tokens.

Installation

You can install the package via composer:

composer require nickcheek/handwriting

Usage

You can use renderPNGImage(), renderPNGString(), or 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

Builder Class

The builder class allows you to inject the settings you'd like for your image in a chainable format.

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

Check the docs if you'd like more information.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email nick@nicholascheek.com instead of using the issue tracker.

Credits

License

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