UriSlug [Deprecated]
Deprecated! Please use URLify instead., (*1)
Overview
Canonicalizes a string to a URL-friendly format. Based on a combination of WordPress functions., (*2)
Installation with Composer
Add to your composer.json, (*3)
{
"require": {
"urislug/urislug": "dev-master"
}
}
Example Usage
<?php
require __DIR__.'/vendor/autoload.php';
// Create as a new instance
$greeting = new \UriSlug('Hello, there ^_^');
// automatically casts to a string if treated as such
echo $greeting; // prints 'hello-there-_'
// same as above
echo $greeting->getSlug();
// Factory method creates new instance with the given text and returns the slug string
echo \UriSlug::create('Welcome to GroĂröhrsdorf!!1!one!'); // prints 'welcome-to-grosrohrsdorf1one';
License
As this is based on functions found in WordPress 3, and WordPress is released under the GPL v2 license, so is this helper class., (*4)