All Projects → jbroadway → Urlify

jbroadway / Urlify

Licence: other
A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

Projects that are alternatives of or similar to Urlify

Slug Generator
Slug Generator Library for PHP, based on Unicode’s CLDR data
Stars: ✭ 740 (+16.9%)
Mutual labels:  unicode, ascii, transliteration, slug
unidecode
Elixir package to transliterate Unicode to ASCII
Stars: ✭ 18 (-97.16%)
Mutual labels:  unicode, ascii, transliteration
Limax
Node.js module to generate URL slugs. Another one? This one cares about i18n and transliterates non-Latin scripts to conform to the RFC3986 standard. Mostly API-compatible with similar modules.
Stars: ✭ 423 (-33.18%)
Mutual labels:  seo, transliteration, slug
Transliteration
UTF-8 to ASCII transliteration / slugify module for node.js, browser, Web Worker, React Native, Electron and CLI.
Stars: ✭ 444 (-29.86%)
Mutual labels:  unicode, ascii, transliteration
Diagon
Interactive ASCII art diagram generators. 🌟
Stars: ✭ 189 (-70.14%)
Mutual labels:  unicode, ascii
Transliterate
Convert Unicode characters to Latin characters using transliteration
Stars: ✭ 152 (-75.99%)
Mutual labels:  unicode, transliteration
table2ascii
Python library for converting lists to fancy ASCII tables for displaying in the terminal and on Discord
Stars: ✭ 31 (-95.1%)
Mutual labels:  unicode, ascii
unihandecode
unihandecode is a transliteration library to convert all characters/words in Unicode into ASCII alphabet that aware with Language preference priorities
Stars: ✭ 71 (-88.78%)
Mutual labels:  unicode, transliteration
Crx Jtrans
jTransliter - the roman to unicode transliter as Google chrome extension
Stars: ✭ 13 (-97.95%)
Mutual labels:  unicode, transliteration
homoglyphs
Homoglyphs: get similar letters, convert to ASCII, detect possible languages and UTF-8 group.
Stars: ✭ 70 (-88.94%)
Mutual labels:  unicode, ascii
mongoose-slug-plugin
Slugs for Mongoose with history and i18n support (uses speakingurl by default, but you can use any slug library such as limax, slugify, mollusc, or slugme)
Stars: ✭ 21 (-96.68%)
Mutual labels:  seo, slug
Unibits
Visualize different Unicode encodings in the terminal
Stars: ✭ 125 (-80.25%)
Mutual labels:  unicode, ascii
Lehar
Visualize data using relative ordering
Stars: ✭ 81 (-87.2%)
Mutual labels:  unicode, ascii
Cowsay Files
A collection of additional/alternative cowsay files.
Stars: ✭ 216 (-65.88%)
Mutual labels:  unicode, ascii
Weird Json
A collection of strange encoded JSONs. For connoisseurs.
Stars: ✭ 53 (-91.63%)
Mutual labels:  unicode, ascii
characteristics
Character info under different encodings
Stars: ✭ 25 (-96.05%)
Mutual labels:  unicode, ascii
durdraw
Animated Unicode, ANSI and ASCII Art Editor for Linux/Unix/macOS
Stars: ✭ 55 (-91.31%)
Mutual labels:  unicode, ascii
agouti
A platform for collective blogs and social media platform, forum, question and answer service. Catalog of sites (programs), site navigation and directories - facets. A community based on the PHP HLEB micro-framework.
Stars: ✭ 36 (-94.31%)
Mutual labels:  blogging, blogs
Lexical Sort
Sort Unicode strings lexicographically
Stars: ✭ 23 (-96.37%)
Mutual labels:  unicode, transliteration
attic
A collection of personal tiny tools - mirror of https://gitlab.com/hydrargyrum/attic
Stars: ✭ 17 (-97.31%)
Mutual labels:  unicode, ascii

URLify for PHP Build Status

A fast PHP slug generator and transliteration library, started as a PHP port of 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:

$ composer require jbroadway/urlify

Usage

First, include Composer's autoloader:

require_once 'vendor/autoload.php';

To generate slugs for URLs:

<?php

echo URLify::slug (' J\'étudie le français ');
// "jetudie-le-francais"

echo URLify::slug ('Lo siento, no hablo español.');
// "lo-siento-no-hablo-espanol"

To generate slugs for file names:

<?php

echo URLify::filter ('фото.jpg', 60, "", true);
// "foto.jpg"

To simply transliterate characters:

<?php

echo URLify::downcode ('J\'étudie le français');
// "J'etudie le francais"

echo URLify::downcode ('Lo siento, no hablo español.');
// "Lo siento, no hablo espanol."

/* Or use transliterate() alias: */

echo URLify::transliterate ('Lo siento, no hablo español.');
// "Lo siento, no hablo espanol."

To extend the character list:

<?php

URLify::add_chars ([
	'¿' => '?', '®' => '(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

URLify::remove_words (['remove', 'these', 'too']);

To prioritize a certain language map:

<?php

echo URLify::filter ('Ägypten und Österreich besitzen wie üblich ein Übermaß an ähnlich öligen Attachés', 60, 'de');
// "aegypten-und-oesterreich-besitzen-wie-ueblich-ein-uebermass-aehnlich-oeligen-attaches"

echo URLify::filter ('Cağaloğlu, çalıştığı, müjde, lazım, mahkûm', 60, 'tr');
// "cagaloglu-calistigi-mujde-lazim-mahkum"

Please note that the "ü" is transliterated to "ue" in the first case, whereas it results in a simple "u" in the latter.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].