kiwa/hyphenizer

Perfect hyphenation for your Website.

0.9.0 2024-10-25 18:55 UTC

This package is auto-updated.

Last update: 2024-10-25 18:56:00 UTC


README

PHP from Packagist Codacy Badge Latest Stable Version Total Downloads License

Kiwa Hyphenizer

Perfect hyphenation for your Website. This library integrates the Hyphenizer into your Kiwa website.

If you don't run your website with Kiwa, you can do this steps by your own.

Please note: The Hyphenizer API requires you to have a valid API token.

Installation

This library is made for the use with Composer. Add it to your project by running $ composer require kiwa/hyphenizer.

Usage

The static hyphenation works in three steps:

1. Extract all long words

To extract all long words from your website, run $ php bin/console hyphenation:list:create in your CLI.

The command will store the extracted words under /hyphenation/hyphenation-words.php.

2. Ask for their correct hyphenation

Ask the Hyphenizer API for the correct hyphenation. Run $ php bin/console hyphenation:list:hyphenate in your CLI.

The command will store the hyphenated words under /hyphenation/hyphenation-words.json.

3. Replace the original words with their hyphenated versions.

You can use the Hyphenation library written in JavaScript to replace all the extracted words. In this case, you need to import your hyphenation-words.json before initializing the class:

import Hyphenation from "kiwa-hyphenizer";
import hyphenatedWords from "hyphenation/hyphenation-words.json";

const hyphenation = new Hyphenation(hyphenatedWords);

Help

If you have any questions, feel free to contact us under hello@bitandblack.com.

Further information about Bit&Black can be found under www.bitandblack.com.