diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md
index 1c8783c..c2a1e6f 100644
--- a/DOCUMENTATION.md
+++ b/DOCUMENTATION.md
@@ -1,11 +1,12 @@
## Installing
-- Install by copying the files into `site/addons/Wikilinks`.
-- That's it.
+```
+composer require statamic/wikilinks
+```
## Usage
-Wikilinks is a simple modifier that seeks out any content wrapped in [braces] and automatically links it to other entries or pages with the same title (or other field of your choosing).
+Wikilinks provides a simple modifier that seeks out any content wrapped in [braces] and automatically links it to other entries or pages with the same title (or other field of your choosing).
### Example
diff --git a/README.md b/README.md
index aee90ee..52675e7 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,12 @@
-# Wikilinks ![Statamic v2](https://img.shields.io/badge/statamic-v2-blue.svg?style=flat-square)
+# Wikilinks ![Statamic v5](https://img.shields.io/badge/statamic-v5-blue.svg?style=flat-square)
-## Modifier
-Wikilinks is a simple modifier that seeks out any content wrapped in [braces] and automatically links it to other entries or pages with the same title (or other field of your choosing).
+Wikilinks is an add-on for Statamic 5.x that enables Wiki style [links] in the content of your site.
+
+It provides a simple modifier that seeks out any content wrapped in [braces] and automatically links it to other entries or pages with the same title (or other field of your choosing).
```
{{ content | wikilinks }}
```
+
+See the Documentation for more details of usage.
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..a51ad5b
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,37 @@
+{
+ "name": "statamic/wikilinks",
+ "autoload": {
+ "psr-4": {
+ "Statamic\\Wikilinks\\": "src"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Statamic\\Wikilinks\\Tests\\": "tests"
+ }
+ },
+ "require": {
+ "statamic/cms": "^5.0"
+ },
+ "require-dev": {
+ "orchestra/testbench": "^9.0"
+ },
+ "config": {
+ "allow-plugins": {
+ "pixelfear/composer-dist-plugin": true
+ }
+ },
+ "extra": {
+ "statamic": {
+ "name": "Wikilinks",
+ "description": "Wikilinks addon"
+ },
+ "laravel": {
+ "providers": [
+ "Statamic\\Wikilinks\\ServiceProvider"
+ ]
+ }
+ },
+ "minimum-stability": "dev",
+ "prefer-stable": true
+}
\ No newline at end of file
diff --git a/meta.yaml b/meta.yaml
deleted file mode 100755
index 5d3ec5b..0000000
--- a/meta.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-name: Wikilinks
-version: "1.0"
-description: 'Autolinks content wrapped in [braces], like a wiki.'
-url: https://statamic.com/marketplace/addons/wikilinks
-developer: Statamic
-developer_url: https://statamic.com
diff --git a/WikilinksModifier.php b/src/Modifiers/WikilinksModifier.php
old mode 100755
new mode 100644
similarity index 57%
rename from WikilinksModifier.php
rename to src/Modifiers/WikilinksModifier.php
index 34c618f..e93bda6
--- a/WikilinksModifier.php
+++ b/src/Modifiers/WikilinksModifier.php
@@ -1,12 +1,15 @@
$query) {
- if ($result = Search::get($query, [$field])) {
+ $result = Entry::query()
+ ->where($field, $query)
+ ->first();
+
+ if ($result) {
- $id = array_get($result->first(), 'id');
- $url = Content::find($id)->url();
+ $uri = $result->uri;
- $replacements[] = ($url) ? "{$query}" : $query;
+ $replacements[] = ($uri) ? "{$query}" : $query;
}
}
return str_replace($matches[0], $replacements, $value);
diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php
new file mode 100644
index 0000000..8bfaabe
--- /dev/null
+++ b/src/ServiceProvider.php
@@ -0,0 +1,18 @@
+