mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-24 13:53:08 +02:00
Update readme and comments for new slugify param
This commit is contained in:
@@ -648,14 +648,15 @@ S::shuffle('fòô bàř', 'UTF-8'); // 'àôřb òf'
|
|||||||
|
|
||||||
#### slugify
|
#### slugify
|
||||||
|
|
||||||
$stringy->slugify()
|
$stringy->slugify([ string $replacement = '-' ])
|
||||||
|
|
||||||
S::slugify(string $str)
|
S::slugify(string $str [, string $replacement = '-' ])
|
||||||
|
|
||||||
Converts the string into an URL slug. This includes replacing non-ASCII
|
Converts the string into an URL slug. This includes replacing non-ASCII
|
||||||
characters with their closest ASCII equivalents, removing non-alphanumeric
|
characters with their closest ASCII equivalents, removing non-alphanumeric
|
||||||
and non-ASCII characters, and replacing whitespace with dashes. The string
|
and non-ASCII characters, and replacing whitespace with $replacement.
|
||||||
is also converted to lowercase.
|
The replacement defaults to a single dash, and the string is also
|
||||||
|
converted to lowercase.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
S::create('Using strings like fòô bàř')->slugify();
|
S::create('Using strings like fòô bàř')->slugify();
|
||||||
|
@@ -325,12 +325,12 @@ class StaticStringy
|
|||||||
/**
|
/**
|
||||||
* Converts the string into an URL slug. This includes replacing non-ASCII
|
* Converts the string into an URL slug. This includes replacing non-ASCII
|
||||||
* characters with their closest ASCII equivalents, removing non-alphanumeric
|
* characters with their closest ASCII equivalents, removing non-alphanumeric
|
||||||
* and non-ASCII characters, and replacing whitespace with dashes. The string
|
* and non-ASCII characters, and replacing whitespace with $replacement.
|
||||||
* is also converted to lowercase. If defined, whitespace is replaced with
|
* The replacement defaults to a single dash, and the string is also
|
||||||
* $replacement instead of dashes.
|
* converted to lowercase.
|
||||||
*
|
*
|
||||||
* @param string $str Text to transform into an URL slug
|
* @param string $str Text to transform into an URL slug
|
||||||
* @param string $replacement The string to replace whitespace with
|
* @param string $replacement The string used to replace whitespace
|
||||||
* @return string The corresponding URL slug
|
* @return string The corresponding URL slug
|
||||||
*/
|
*/
|
||||||
public static function slugify($str, $replacement = '-')
|
public static function slugify($str, $replacement = '-')
|
||||||
|
@@ -577,11 +577,11 @@ class Stringy
|
|||||||
/**
|
/**
|
||||||
* Converts the string into an URL slug. This includes replacing non-ASCII
|
* Converts the string into an URL slug. This includes replacing non-ASCII
|
||||||
* characters with their closest ASCII equivalents, removing non-alphanumeric
|
* characters with their closest ASCII equivalents, removing non-alphanumeric
|
||||||
* and non-ASCII characters, and replacing whitespace with dashes. The string
|
* and non-ASCII characters, and replacing whitespace with $replacement.
|
||||||
* is also converted to lowercase. If defined, whitespace is replaced with
|
* The replacement defaults to a single dash, and the string is also
|
||||||
* $replacement instead of dashes.
|
* converted to lowercase.
|
||||||
*
|
*
|
||||||
* @param string $replacement The string to replace whitespace with
|
* @param string $replacement The string used to replace whitespace
|
||||||
* @return Stringy Object whose $str has been converted to an URL slug
|
* @return Stringy Object whose $str has been converted to an URL slug
|
||||||
*/
|
*/
|
||||||
public function slugify($replacement = '-')
|
public function slugify($replacement = '-')
|
||||||
|
Reference in New Issue
Block a user