diff --git a/app/Http/Controllers/AnagramController.php b/app/Http/Controllers/AnagramController.php
index 4dd76e1..b3d8593 100644
--- a/app/Http/Controllers/AnagramController.php
+++ b/app/Http/Controllers/AnagramController.php
@@ -2,13 +2,31 @@
namespace App\Http\Controllers;
+use App\Http\Requests\FindAnagramWordsRequest;
+use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
+use Lvl0\AnagramFinder\Core\Matcher;
class AnagramController extends Controller
{
- public function __invoke(Request $request): View
+ public function index(): View
{
return view('index');
}
+
+ public function find(FindAnagramWordsRequest $request): RedirectResponse
+ {
+ $anagram = $request->get('anagram');
+
+ return redirect()->route('results', $anagram);
+ }
+
+ public function results(Request $request)
+ {
+ $anagram = $request->anagram;
+ $matches = Matcher::findWords($anagram);
+
+ return view('index', ['anagram' => $anagram, 'matches' => $matches]);
+ }
}
diff --git a/app/Http/Requests/FindAnagramWordsRequest.php b/app/Http/Requests/FindAnagramWordsRequest.php
new file mode 100644
index 0000000..f2205d7
--- /dev/null
+++ b/app/Http/Requests/FindAnagramWordsRequest.php
@@ -0,0 +1,29 @@
+|string>
+ */
+ public function rules(): array
+ {
+ return [
+ //
+ ];
+ }
+}
diff --git a/composer.json b/composer.json
index 625c389..73825ba 100644
--- a/composer.json
+++ b/composer.json
@@ -10,6 +10,7 @@
"license": "MIT",
"require": {
"php": "^8.3",
+ "anagram-finder/core": "^0.1.0",
"laravel/chisel": "^0.1.0",
"laravel/fortify": "^1.37.2",
"laravel/framework": "^13.17",
@@ -110,5 +111,11 @@
}
},
"minimum-stability": "stable",
- "prefer-stable": true
-}
\ No newline at end of file
+ "prefer-stable": true,
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "ssh://git@forge.lvl0.xyz:2222/anagram-finder/core.git"
+ }
+ ]
+}
diff --git a/composer.lock b/composer.lock
index 70aee8c..ede989f 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,42 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "09b46aa9ca1844f1ec49d90281d6a76b",
+ "content-hash": "421410120a87c8f8ec2456627557bc36",
"packages": [
+ {
+ "name": "anagram-finder/core",
+ "version": "v0.1.0",
+ "source": {
+ "type": "git",
+ "url": "ssh://git@forge.lvl0.xyz:2222/anagram-finder/core.git",
+ "reference": "4b8ce74729fa9a6d0ca91c5d661256ca256e5291"
+ },
+ "require": {
+ "illuminate/collections": "^13.26"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.95",
+ "phpunit/phpunit": "^13"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Lvl0\\AnagramFinder\\Core\\": "src/",
+ "Lvl0\\AnagramFinder\\Core\\Tests\\": "tests/"
+ }
+ },
+ "license": [
+ "AGPL-3.0-only"
+ ],
+ "authors": [
+ {
+ "name": "myrmidex",
+ "email": "myrmidex@myrmidex.net"
+ }
+ ],
+ "description": "AnagramFinder core",
+ "time": "2026-08-22T17:50:27+00:00"
+ },
{
"name": "bacon/bacon-qr-code",
"version": "v3.1.1",
diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php
index 543a0a0..8aced73 100644
--- a/resources/views/index.blade.php
+++ b/resources/views/index.blade.php
@@ -50,71 +50,46 @@ class="inline-block px-5 py-1.5 dark:text-[#EDEDEC] border-[#19140035] hover:bor
-
Let's get started
-
Laravel has an incredibly rich ecosystem.
We suggest starting with the following.
-
-
+
Anagram Finder
+
Enter your letters to find every word that fits.
+
+
+ @isset($matches)
+
+
+ @foreach($matches as $match)
+ - {{ $match }} ({{ strlen($match) }})
+ @endforeach
+
+
+ @endisset
diff --git a/routes/web.php b/routes/web.php
index a313682..427ee2b 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -3,7 +3,11 @@
use App\Http\Controllers\AnagramController;
use Illuminate\Support\Facades\Route;
-Route::get('/', AnagramController::class)->name('home');
+Route::controller(AnagramController::class)->group(function () {
+ Route::get('/', 'index')->name('home');
+ Route::post('/', 'find')->name('find');
+ Route::get('/find/{anagram}', 'results')->name('results');
+});
Route::middleware(['auth', 'verified'])->group(function () {
Route::view('dashboard', 'dashboard')->name('dashboard');