# `PhoenixKit.Utils.Slug`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.87/lib/phoenix_kit/utils/slug.ex#L1)

Helpers for generating consistent, URL-friendly slugs across PhoenixKit.

Provides functions to slugify arbitrary text, enforce separator rules,
and ensure uniqueness by delegating existence checks via callback.

# `ensure_unique`

```elixir
@spec ensure_unique(String.t(), (String.t() -&gt; boolean())) :: String.t()
```

Ensures the provided slug is unique by calling `exists_fun`.

`exists_fun` should return truthy when the slug is already taken.

# `slugify`

```elixir
@spec slugify(
  String.t() | nil,
  keyword()
) :: String.t()
```

Converts the given `text` into a slug.

Options:
  * `:separator` - character used between words (defaults to "-")

Returns an empty string when the input is blank or cannot be converted.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
