Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbroadway/urlify
A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.
https://github.com/jbroadway/urlify
ascii blogging blogs php pretty-url pretty-urls seo slug slugify slugs transliteration unicode urlify urls
Last synced: 6 days ago
JSON representation
A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.
- Host: GitHub
- URL: https://github.com/jbroadway/urlify
- Owner: jbroadway
- License: bsd-3-clause
- Created: 2012-05-01T22:28:56.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-10-05T14:51:07.000Z (about 1 year ago)
- Last Synced: 2024-11-29T19:09:19.462Z (12 days ago)
- Topics: ascii, blogging, blogs, php, pretty-url, pretty-urls, seo, slug, slugify, slugs, transliteration, unicode, urlify, urls
- Language: PHP
- Homepage:
- Size: 158 KB
- Stars: 674
- Watchers: 34
- Forks: 79
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-php - URLify - A PHP port of Django's URLify.js. (Table of Contents / Strings)
- awesome-php-cn - URLify - 一个PHP Django的URLify港.js. (目录 / 字符串 Strings)
- awesome-projects - URLify - A PHP port of Django's URLify.js. (PHP / Strings)
- awesome-php - URLify - A PHP port of Django's URLify.js. (Table of Contents / Strings)
README
# URLify for PHP
![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/jbroadway/urlify/ci.yml?branch=master)
![Packagist License](https://img.shields.io/packagist/l/jbroadway/urlify)
![Packagist Version](https://img.shields.io/packagist/v/jbroadway/urlify)
![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/jbroadway/urlify)
![Packagist Downloads](https://img.shields.io/packagist/dt/jbroadway/urlify)A fast PHP slug generator and transliteration library, started as a PHP port of
[URLify.js](https://github.com/django/django/blob/master/django/contrib/admin/static/admin/js/urlify.js)
from the Django project.Handles symbols from latin languages, Arabic, Azerbaijani, Bulgarian, Burmese, Croatian, Czech, Danish, Esperanto,
Estonian, Finnish, French, Switzerland (French), Austrian (French), Georgian, German, Switzerland (German),
Austrian (German), Greek, Hindi, Kazakh, Latvian, Lithuanian, Norwegian, Persian, Polish, Romanian, Russian, Swedish,
Serbian, Slovak, Turkish, Ukrainian and Vietnamese, and many other via `ASCII::to_transliterate()`.Symbols it cannot transliterate it can omit or replace with a specified character.
## Installation
Install the latest version with:
```bash
$ composer require jbroadway/urlify
```## Usage
First, include Composer's autoloader:
```php
require_once 'vendor/autoload.php';
```To generate slugs for URLs:
```php
'?', '®' => '(r)', '¼' => '1/4',
'½' => '1/2', '¾' => '3/4', '¶' => 'P'
]);echo URLify::downcode ('¿ ® ¼ ¼ ¾ ¶');
// "? (r) 1/2 1/2 3/4 P"
```To extend the list of words to remove:
```php