oliverklee / anagram-finder
A tool for finding anagrams from a list of words (as an exercise of test-driven development).
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 3
Type:project
Requires
- php: ~8.3.0 || ~8.4.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.44.0
- friendsofphp/php-cs-fixer: ^3.64.0
- infection/infection: ^0.29.8
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^1.12.8
- phpstan/phpstan-deprecation-rules: ^1.2.1
- phpstan/phpstan-phpunit: ^1.4.0
- phpstan/phpstan-strict-rules: ^1.6.1
- phpunit/phpunit: ^11.4.3
- rector/rector: ^1.2.9
- typo3/coding-standards: ^0.8.0
This package is auto-updated.
Last update: 2024-11-06 22:50:52 UTC
README
This tool is the result of an exercise (code kata, coding dojo) for test-driven development (TDD) for PHP using PHPUnit at Oliver Klee's workshops.
An anagram is pair of two words that consist of exactly the same letters, but in different order.
Example: anthologise, theologians
The dictionaries have been copied from the most-common-words-by-language project.
Installation
Run composer install
to install the required Composer packages.
How to run it
bin/find-anagrams
You can also specify a dictionary to use from resources/dictionaries/
:
bin/find-anagrams german.txt
The exercises
The big picture is this: "Find and output all anagrams from a text file with a list of words."
- Create a class that reads a list of words from a file and returns it as an array.
- Create a class that takes a word and sorts the characters.
- Create a class that finds and returns the anagram from an array of words.
- Deal with duplicates and empty lines in the file gracefully.
- Find the anagrams in a case-insensitive way.
- Sort the anagrams alphabetically during output.
About me (Oliver Klee)
I am the maintainer of the PHPUnit TYPO3 extension, which is available in the TYPO3 extension repository (TER).
You can book me for workshops at your company.
I also frequently give workshops at the TYPO3 Developer Days.
More Documentation
Other example projects
- Coffee example is my starting point for demonstrating TDD
- Tea example for testing Extbase TYPO3 extensions