malahierba-lab / word-counter by malahierba

Laravel simple tool for word counting tasks
1,172
2
2
Package Data
Maintainer Username: malahierba
Maintainer Contact: lab@malahierba.cl (malahierba team)
Package Create Date: 2015-11-16
Package Last Update: 2018-01-15
Language: PHP
License: MIT
Last Refreshed: 2024-11-14 15:10:18
Package Statistics
Total Downloads: 1,172
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 2
Total Watchers: 2
Total Forks: 2
Total Open Issues: 1

Laravel Word Counter

Laravel simple tool for word counting tasks. Powered by malahierba.cl dev team

Installation

Add in your composer.json:

{
    "require": {
        "malahierba-lab/word-counter": "0.*"
    }
}

Then you need run the composer update command.

Use

Important: For documentation purposes, in the examples below, always we assume than you import the library into your namespace using use Malahierba\WordCounter;

$wordcounter = new WordCounter;

// Load string to analize
$wordcounter->load('some text');

// Count all words
$total = $wordcounter->countTotalWords();

// Count each word
// You receive an array with objects:
// -> word
// -> count
$eachWord = $wordcounter->countEachWord();

//example to get info for each word
foreach ($eachWord as $item) {
    $word   = $item->word;
    $count  = $item->count;
}

Licence

This project has MIT licence. For more information please read LICENCE file.