Download the PHP package pid/speakingurl without Composer
On this page you can find all versions of the php package pid/speakingurl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pid/speakingurl
More information about pid/speakingurl
Files in pid/speakingurl
Package speakingurl
Short Description Generate of so called 'static' or 'Clean URL' or 'Pretty URL' or 'nice-looking URL' or 'Speaking URL' or 'user-friendly URL' or 'SEO-friendly URL' or 'slug' from a string.
License BSD
Homepage http://pid.github.io/speakingurl/
Informations about the package speakingurl
SpeakingURL
Generate a slug with a lot of options; create a so-called Semantic URL or 'Clean URL' or 'Pretty URL' or 'nice-looking URL' or 'Speaking URL' or 'user-friendly URL' or 'SEO-friendly URL' from a string. This module aims to transliterate the input string.
For use in browser and server - no dependencies!
NPM Badge
Installation
npm
yarn
Bower
Component
Ruby on Rails
Download Package
copy the file speakingurl.min.js to your script directory
CDN/cloudflare
available versions:
- www.cdnjs.com/libraries/speakingurl/
- use //cdnjs.cloudflare.com/ajax/libs/speakingurl/14.0.1/speakingurl.min.js
CDN/maxcdn
available versions:
Usage
getSlug(input, [options]);
input
: {string} to convert
options
{object|string} config object or separator string (see below)
-
options
{object}separator
{string} default: '-'- char that replaces the whitespaces
lang
{string|boolean} default: 'en' // ISO 639-1 Codes- language specific transliteration (
- 'ar' // Arabic
- 'az' // Azerbaijani*
- 'cs' // Czech
- 'de' // German
- 'dv' // Divehi
- 'en' // English
- 'es' // Spanish
- 'fa' // Persian
- 'fi' // Finnish
- 'fr' // French
- 'ge' // Georgian
- 'gr' // Greek*
- 'hu' // Hungarian
- 'it' // Italian
- 'lt' // Lithuanian*
- 'lv' // Latvian
- 'my' // Burmese
- 'mk' // Macedonian*
- 'nl' // Dutch
- 'pl' // Polish
- 'pt' // Portuguese
- 'ro' // Romanian
- 'ru' // Russian
- 'sv' // Swedish
- 'sk' // Slovak
- 'sr' // Serbian*
- 'tr' // Turkish
- 'uk' // Ukranian
- 'vn' // Vietnamese
- language specific transliteration (
symbols
{boolean} default: true- false -> don't convert symbols
- true -> convert symbols according to the 'lang' setting
maintainCase
{boolean} default: false- true -> maintain case chars
- false -> convert all chars to lower case
titleCase
{boolean|array} default: false- true -> convert input string to title-case
- array -> titlecase = true, but omit the words from in the array
truncate
{number} default: 0- 0 -> don't trim length
- >= 1 -> trim to max length while not breaking any words
uric
{boolean} default: false- true -> additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "\$", ",", "/"
- false
uricNoSlash
{boolean} default: false- true -> additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "\$", ","
mark
{boolean} default: false- true -> additionally allow chars: "-", "_", ".", "!", "~", "*", "'", "(", ")"
custom
{object|array} default: {}- object -> custom map for translation, overwrites all i.e. { '&': '#', '*': ' star ' }
- array -> add chars to allowed charMap (see example)
options
{string} separator
notes: default only Base64 chars are allowed (/A-Za-z0-9_-/), setting uric
, uricNoSlash
or/and mark
to true
will add the specified chars to the list of allowed characters. The separator-character is always allowed.
Node.js
Browser
Ruby on Rails
Examples
createSlug([options])
options
: {object|string} config object or separator string (see above)
Create your own specially configured function.
Create your own specially configured function with title-case feature.
Changelog
see CHANGELOG.md
Tests
Contribution
Release
Release to RubyGems.org
References
Use in other environments
Ports
- Java https://github.com/Weltraumschaf/speakingurl thanks to@Weltraumschaf
Credits
License
The BSD 3-Clause License (BSD3)
Copyright (c) 2013-2017 Sascha Droste [email protected] All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.