divineomega / php-word-info
PHP library to look up information about words
Fund package maintenance!
DivineOmega
Requires
- php: ^7.0
- davechild/textstatistics: ^1.0
- divineomega/is_offensive: ^1.0
- doctrine/inflector: ^1.2
- rapidwebltd/rw-file-cache: ^1.2
Requires (Dev)
- phpunit/phpunit: ^5.7
- satooshi/php-coveralls: ^2.0
README
This PHP library can be used to look up information about a word, including the following.
- Rhymes
- Half rhymes
- Number of syllables
- Offensive or not
- Portmanteaus
- Plural / singular
Installation
PHP Word Info can be easily installed using Composer. Just run the following command from the root of your project.
composer require divineomega/php-word-info
If you have never used the Composer dependency manager before, head to the Composer website for more information on how to get started.
Usage
To use PHP Word Info, you must first create a new Word
object. You can then call any of the Word
object methods, as shown below.
$word = new Word('cat'); $rhymes = $word->rhymes(); $halfRhymes = $word->halfRhymes(); $portmanteaus = $word->portmanteaus(); $numberOfSyllables = $word->syllables(); // Returns an integer $isOffensive = $word->offensive(); // Returns true/false $plural = $word->plural(); // Returns `Word` object $singular = $word->singular(); // Returns `Word` object
Most methods will return an array of Word
objects, unless specified otherwise.