To::kebab()

Converts current value to kebab/slug case.

Table of Contents
  1. Description
  2. Example

Description

To::kebab(?string $value, string $join = '-', array|bool $accent = false): ?string;

This method converts current value to kebab/slug case.

Example

$value = To::kebab(""); // Returns `null`
$value = To::kebab('!@#$%^&*()'); // Returns `null`
$value = To::kebab(" \n\r\t"); // Returns `null`
$value = To::kebab('foo bar baz'); // Returns `'foo-bar-baz'`
$value = To::kebab('FOO BAR BAZ'); // Returns `'f-o-o-b-a-r-b-a-z'`
$value = To::kebab('Foo Bar Baz'); // Returns `'foo-bar-baz'`
$value = To::kebab('FooBarBaz'); // Returns `'foo-bar-baz'`
$value = To::kebab('foo-bar-baz'); // Returns `'foo-bar-baz'`
$value = To::kebab('foo_bar_baz'); // Returns `'foo-bar-baz'`
$value = To::kebab('Foo_Bar_Baz'); // Returns `'foo-bar-baz'`
$value = To::kebab('Tom & Jerry', '-', ['&' => 'and']); // Returns `'tom-and-jerry'`
$value = To::kebab('How many Pokémon’s are there?', '-', false); // Returns `'how-many-pokemon-s-are-there'`
$value = To::kebab('How many Pokémon’s are there?', '-', true); // Returns `'how-many-pokémon’s-are-there'`

To::URL()

Converts private file path to public URL, or decodes URL special characters.

To::entity()

Converts characters to their corresponding HTML entities.

To::file()

Converts current value to a safe file name.

To::kebab()

Converts current value to kebab/slug case.

To::path()

Converts public URL to private file path.