diff --git a/blog/2025-06-03-snail.mdx b/blog/2025-06-03-snail.mdx new file mode 100644 index 0000000..0b4d11e --- /dev/null +++ b/blog/2025-06-03-snail.mdx @@ -0,0 +1,12 @@ +--- +title: Snail +authors: [jannik] +tags: [snail] +--- + +We have new bundle for [snails]. + +Read more in the docs about what snails are and what they are used for. + + +[snails]: /docs/php/symfony/snail diff --git a/docs/php/symfony/snail/index.mdx b/docs/php/symfony/snail/index.mdx new file mode 100644 index 0000000..fb76517 --- /dev/null +++ b/docs/php/symfony/snail/index.mdx @@ -0,0 +1,59 @@ +import {LinkList} from "../../../../src/components/Link/LinkList"; + +# Snail + + + +A bundle with helpers for using *snails*. + +:::tip +A *snail* is a **slug** with a very specific format. +::: + +The format of a snail is: + +- only lower case latin letters (`[a-z]`) +- numbers (`[0-9]`) +- special characters: `. _ -` +- must not end or start on a special character +- no consecutive multiple special characters (so no `a-_b` allowed) + + +Snails are URL safe and safe to use on the CLI as key. + + +## Installation + +Install the bundle: + +```bash +composer require 21torr/snail +``` + +## Usage + +### Validating a snail + +```php +use Torr\Snail\Snail\Snailer; + +Snailer::isValidSnail($string); +``` + + +### Generating a snail + +You can also generate a snail from any string. +Please note that consecutive special characters will be collapsed to the first special character (so `".-_." -> "."`). + +The snailer also removes all not-allowed characters. If the result will be an empty string, a `SnailGenerationFailedException` will be thrown. + +```php +use Torr\Snail\Snail\Snailer; + +$snailer = new Snailer(); +$snailer->generateSnail($string); +``` diff --git a/docs/php/symfony/storyblok/components/recommended-directory-structure.mdx b/docs/php/symfony/storyblok/components/recommended-directory-structure.mdx index 77236e7..ca97290 100644 --- a/docs/php/symfony/storyblok/components/recommended-directory-structure.mdx +++ b/docs/php/symfony/storyblok/components/recommended-directory-structure.mdx @@ -15,7 +15,7 @@ src/ │ ├─ Widget/ │ ├─ ComponentGroup.php │ └─ ComponentTag.php - └ Field/ + └─ Field/ └─ Composite/ ```