-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathexample.php
More file actions
executable file
·36 lines (27 loc) · 869 Bytes
/
example.php
File metadata and controls
executable file
·36 lines (27 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';
$slugifier = new \Slug\Slugifier;
function slugify($string) {
global $slugifier;
return $string . ' => ' . $slugifier->slugify($string) . PHP_EOL;
}
echo slugify('Hello world!');
echo slugify('Un titre en bon français !');
/**
* Brazilian Portuguese example - Just for information
*
* In Portuguese language is very commom to use accentuations
* an below there's an example how easy is to use this Slugifier.
*
* @global \Slug\Slugifier $slugifier
* @param type $brazilianString
*
*/
function slugifyBR($brazilianString) {
global $slugifier;
$slugifier->setTransliterate(true);
return $brazilianString . ' => ' . $slugifier->slugify($brazilianString) . PHP_EOL;
}
// This is it! a stupidly easy slugifier -- Congrats!
echo slugifyBR('Teste com acentuação');