opeyemiabiodun / urban-dictionary
Make your dictionary of slangs.
Requires
- php: >=5.6.0
Requires (Dev)
- phpunit/phpunit: 5.*
This package is not auto-updated.
Last update: 2024-10-26 19:37:43 UTC
README
CheckPoint 1/a; Urban-Dictionary Agnostic PHP Package
The package enables the non-persistent storage of data. Specifically; slangs, their meanings and examples of sentences where they are used. Creating, reading, updating and deleting records of these slangs are also made possible by this package. Finally, the package can also rank words within sentences by the number of occurences of these words within the sentences. PSR-2 coding standard was adopted in writing the package. The PSR-4 autoloading convention was also adopted.
Install
Via Composer
$ composer require opeyemiabiodun/urban-dictionary
Usage
<?php require "vendor/autoload.php"; use Opeyemiabiodun/UrbanDictionary/Dictionary; use Opeyemiabiodun/UrbanDictionary/Rank; /* The following methods below perform CRUD operations in the dictionary. The arguments passed into the methods are strings. */ Dictionary::getInstance()->add($slang, $description, $sampleSentence); Dictionary::getInstance()->read($slang); Dictionary::getInstance()->select($slang); Dictionary::getInstance()->update($slang, $description, $sampleSentence); Dictionary::getInstance()->delete($slang); Dictionary::getInstance()->getAll(); Dictionary::getInstance()->clear(); /* To update a slang in the dictionary.First select it before passing in updated values. */ Dictionary::getInstance()->select($slang); Dictionary::getInstance()->update($slang, $description, $sampleSentence); $_sentences = “Andrei: Prosper, Have you finished the curriculum?. Prosper: Yes. Andrei: Tight, Tight, Tight!!!” $wordsRank = Rank::getInstance()->execute($_sentences); /* $wordsRank = [“Tight” => 3, “Prosper” => 2, “Yes” => 1, “Have” => 1, “you” => 1, “finished” => 1, “the” => 1, “curriculum?” => 1]; */ ?>
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email opeyemi.ogunjimi@andela.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.