ashleydawson / slugify
Lightweight slugify library
Installs: 14 144
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.3.3
Requires (Dev)
- phpunit/phpunit: 4.3.*
This package is auto-updated.
Last update: 2024-11-14 03:31:03 UTC
README
Installation
You can install Slugify via Composer. To do that, simply require the package in your composer.json file like so:
{ "require": { "ashleydawson/slugify": "~1.0" } }
Then run composer update to install the package.
Basic Usage
Using slugify is easy - simply instantiate the slugifier service class and call the slugify method:
require_once __DIR__ . '/vendor/autoload.php'; use AshleyDawson\Slugify\Slugifier; $slugifier = new Slugifier(); $text = $slugifier->slugify('Hello World'); // The value of $text will be "hello-world" echo $text;
If you'd like to change the delimiter used, simply pass it as the second argument to the slugify method:
require_once __DIR__ . '/vendor/autoload.php'; use AshleyDawson\Slugify\Slugifier; $slugifier = new Slugifier(); $text = $slugifier->slugify('Hello World', '_'); // The value of $text will be "hello_world" echo $text;