https://github.com/hsynlms/php-url-record
A simple slug generator
https://github.com/hsynlms/php-url-record
seo-friendly slug slugify
Last synced: 5 months ago
JSON representation
A simple slug generator
- Host: GitHub
- URL: https://github.com/hsynlms/php-url-record
- Owner: hsynlms
- License: mit
- Created: 2021-02-22T20:52:08.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-22T22:19:40.000Z (almost 4 years ago)
- Last Synced: 2024-10-20T03:06:39.361Z (6 months ago)
- Topics: seo-friendly, slug, slugify
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## php-url-record
> A simple slug generator. It's a PHP port from [nopCommerce](https://github.com/nopSolutions/nopCommerce) UrlRecord service.## Why php-url-record?
The reason behind this repository is nopCommerce, is an open source ASP.NET Core based ecommerce solution. I just wanted to create a port of the nopCommerce SEO friendly slug generation service which is in production for years and trusted by tens of thousands of stores.## Install
```
$ composer require hsynlms/url-record
```## Usage
```php
use hsynlms\UrlRecord;$slugGenerator = new UrlRecord();
echo $slugGenerator->GetSeoFriendlyName('nobodY d0es_it better');
// will return -> nobody-d0es_it-better
```## Options
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| name | string | - | The string that will be slugified |
| convertNonWesternChars | boolean | true | A value indicating whether non western chars should be converted |
| allowUnicodeCharsInUrls | boolean | false | A value indicating whether Unicode chars are allowed |## Compatibility
PHP 7 >= 7.4.0 required due to use of built-in [mb_str_split](https://www.php.net/manual/en/function.mb-str-split.php) function.