File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ title : Snail
3+ authors : [jannik]
4+ tags : [snail]
5+ ---
6+
7+ We have new bundle for [ snails] .
8+
9+ Read more in the docs about what snails are and what they are used for.
10+
11+
12+ [ snails ] : /docs/php/symfony/snail
Original file line number Diff line number Diff line change 1+ import {LinkList } from " ../../../../src/components/Link/LinkList" ;
2+
3+ # Snail
4+
5+ <LinkList
6+ github = " https://github.com/21TORR/SnailBundle"
7+ packagist = " https://packagist.org/packages/21torr/snail"
8+ />
9+
10+ A bundle with helpers for using * snails* .
11+
12+ :::tip
13+ A * snail* is a ** slug** with a very specific format.
14+ :::
15+
16+ The format of a snail is:
17+
18+ - only lower case latin letters (` [a-z] ` )
19+ - numbers (` [0-9] ` )
20+ - special characters: ` . _ - `
21+ - must not end or start on a special character
22+ - no consecutive multiple special characters (so no ` a-_b ` allowed)
23+
24+
25+ Snails are URL safe and safe to use on the CLI as key.
26+
27+
28+ ## Installation
29+
30+ Install the bundle:
31+
32+ ``` bash
33+ composer require 21torr/snail
34+ ```
35+
36+ ## Usage
37+
38+ ### Validating a snail
39+
40+ ``` php
41+ use Torr\Snail\Snail\Snailer;
42+
43+ Snailer::isValidSnail($string);
44+ ```
45+
46+
47+ ### Generating a snail
48+
49+ You can also generate a snail from any string.
50+ Please note that consecutive special characters will be collapsed to the first special character (so ` ".-_." -> "." ` ).
51+
52+ The snailer also removes all not-allowed characters. If the result will be an empty string, a ` SnailGenerationFailedException ` will be thrown.
53+
54+ ``` php
55+ use Torr\Snail\Snail\Snailer;
56+
57+ $snailer = new Snailer();
58+ $snailer->generateSnail($string);
59+ ```
Original file line number Diff line number Diff line change 1515 β ββ Widget/
1616 β ββ ComponentGroup.php
1717 β ββ ComponentTag.php
18- β Field/
18+ ββ Field/
1919 ββ Composite/
2020```
2121
You canβt perform that action at this time.
0 commit comments