public function testCanConfigureSlugResult() { $slugifier = new Slugifier(); $slugifier->setLimit(40); $slugifier->setDelimiter('_'); $slugifier->setLowercase(false); $slugifier->setReplacements(array('/\\b(an)\\b/i' => 'a', '/\\b(example)\\b/i' => 'Test')); $slug = $slugifier->slugify('This is an Example String. What\'s Going to Happen to Me?'); assertequals('This_is_a_Test_String_What_s_Going_to_Ha', $slug); }
public function generate($str) { $slugifier = new Slugifier(); $slugifier->setTransliterate(true); return $slugifier->slugify($str); }
<meta charset="utf8"> <?php ini_set('display_errors', true); error_reporting(E_ALL); require_once "./vendor/autoload.php"; require './vendor/ftsl/src/FTSL/Teste.php'; use Slug\Slugifier; use BrazilianHelper\StateHelper as Teste; $slugifier = new Slugifier(); $slugifier->setTransliterate(true); $string = "André Com acentuação"; $slug = $slugifier->slugify($string); echo "Normal: " . $string . "<br />"; echo "Slug: " . $slug . "<br />"; echo "<br /><br /><br /><br /><br /><br />"; $estados = Teste::getStates(); echo "<pre>"; print_r($estados); echo "</pre>"; ?> <select> <?php echo Teste::getHtmlForSelectElement(); ?> </select>