class StringHandler (View source)

String handling methods.

Methods

static string
removeDiacritics(string $string)

Remove diacritics characters and replace them with their basic alpha letter.

static string
slugify(string $string)

Transform to lowercase and remplace every non-alpha character with a dash.

static string
classify(string $string)

Transform a string for use as a classname.

static string
cleanForFilename(string $string)

Transform to lowercase and remplace every non-alpha character with an underscore.

static string
variablize(string $string)

Transform to lowercase and remplace every non-alpha character with an underscore.

static string
camelCase(string $string)

Transform to camelcase.

static string
encodeWithSecret(string $value, string $secret)

Encode a string using website security secret.

static string
decodeWithSecret(string $value, string $secret)

Decode a string using website security secret.

static bool
endsWith(string $haystack, string $needle)

No description

static string
replaceLast(string $search, string $replace, string $subject)

No description

Details

static string removeDiacritics(string $string)

Remove diacritics characters and replace them with their basic alpha letter.

Parameters

string $string

Return Value

string

static string slugify(string $string)

Transform to lowercase and remplace every non-alpha character with a dash.

Parameters

string $string

Return Value

string Slugified string

static string classify(string $string)

Transform a string for use as a classname.

Parameters

string $string

Return Value

string Classified string

static string cleanForFilename(string $string)

Transform to lowercase and remplace every non-alpha character with an underscore.

Parameters

string $string

Return Value

string Slugified string

static string variablize(string $string)

Transform to lowercase and remplace every non-alpha character with an underscore.

Parameters

string $string

Return Value

string Variablized string

static string camelCase(string $string)

Transform to camelcase.

Parameters

string $string

Return Value

string

static string encodeWithSecret(string $value, string $secret)

Encode a string using website security secret.

Parameters

string $value String to encode
string $secret Secret salt

Return Value

string

Exceptions

EmptySaltException

static string decodeWithSecret(string $value, string $secret)

Decode a string using website security secret.

Parameters

string $value Salted base64 string
string $secret Secret salt

Return Value

string

Exceptions

EmptySaltException

static bool endsWith(string $haystack, string $needle)

Parameters

string $haystack
string $needle

Return Value

bool

static string replaceLast(string $search, string $replace, string $subject)

Parameters

string $search
string $replace
string $subject

Return Value

string