kiwa / hyphenizer
Perfect hyphenation for your Website.
Fund package maintenance!
Buymeacoffee
Requires
- php: >=7.4
- ext-dom: *
- ext-json: *
- bitandblack/helpers: ^1.0 || ^2.0
- fig/http-message-util: ^1.0
- php-http/discovery: ^1.0
- psr/http-client: ^1.0
- psr/log: ^1.0 || ^2.0 || ^3.0
- symfony/console: ^5.0 || ^6.0 || ^7.0
Requires (Dev)
- kiwa/core: ^0 || ^1.0
- nyholm/psr7: ^1.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^11.0
- rector/rector: ^1.0
- symfony/http-client: ^7.0
- symplify/easy-coding-standard: ^12.0
README
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.