zendframework/zend-filter
Filtering and normalization utilities for PHP from Zend Framework. Provides a range of filters to sanitize, convert, and transform input (strings, numbers, arrays, etc.), with extensible interfaces for custom filters—useful for validation pipelines and data processing.
In addition to the standard set of filters, there are several classes specific to filtering word strings.
This filter modifies a given string such that CamelCaseWords are converted to Camel-Case-Words.
There are no additional options for Zend\Filter\Word\CamelCaseToDash:
$filter = new Zend\Filter\Word\CamelCaseToDash();
print $filter->filter('ThisIsMyContent');
The above example returns This-Is-My-Content.
This filter modifies a given string such that CamelCaseWords are converted to Camel Case Words.
The following options are supported for Zend\Filter\Word\CamelCaseToSeparator:
separator: A separator character. If this is not set, the default separator
is a space.$filter = new Zend\Filter\Word\CamelCaseToSeparator(':');
// or new Zend\Filter\Word\CamelCaseToSeparator(array('separator' => ':'));
print $filter->filter('ThisIsMyContent');
The above example returns This:Is:My:Content.
$filter = new Zend\Filter\Word\CamelCaseToSeparator();
print $filter->filter('ThisIsMyContent');
The above example returns This Is My Content.
This filter modifies a given string such that CamelCaseWords are converted to
Camel_Case_Words.
There are no additional options for Zend\Filter\Word\CamelCaseToUnderscore:
$filter = new Zend\Filter\Word\CamelCaseToUnderscore();
print $filter->filter('ThisIsMyContent');
The above example returns This_Is_My_Content.
This filter modifies a given string such that words-with-dashes are converted
to WordsWithDashes.
There are no additional options for Zend\Filter\Word\DashToCamelCase:
$filter = new Zend\Filter\Word\DashToCamelCase();
print $filter->filter('this-is-my-content');
The above example returns ThisIsMyContent.
This filter modifies a given string such that words-with-dashes are converted
to words with dashes.
The following options are supported for Zend\Filter\Word\DashToSeparator:
separator: A separator character. If this is not set, the default separator
is a space.$filter = new Zend\Filter\Word\DashToSeparator('+');
// or new Zend\Filter\Word\CamelCaseToSeparator(array('separator' => '+'));
print $filter->filter('this-is-my-content');
The above example returns this+is+my+content.
$filter = new Zend\Filter\Word\DashToSeparator();
print $filter->filter('this-is-my-content');
The above example returns this is my content.
This filter modifies a given string such that words-with-dashes are converted
to words_with_dashes.
There are no additional options for Zend\Filter\Word\DashToUnderscore:
$filter = new Zend\Filter\Word\DashToUnderscore();
print $filter->filter('this-is-my-content');
The above example returns this_is_my_content.
This filter modifies a given string such that words with separators are
converted to WordsWithSeparators.
The following options are supported for Zend\Filter\Word\SeparatorToCamelCase:
separator: A separator character. If this is not set, the default separator
is a space.$filter = new Zend\Filter\Word\SeparatorToCamelCase(':');
// or new Zend\Filter\Word\SeparatorToCamelCase(array('separator' => ':'));
print $filter->filter('this:is:my:content');
The above example returns ThisIsMyContent.
$filter = new Zend\Filter\Word\SeparatorToCamelCase();
print $filter->filter('this is my content');
The above example returns ThisIsMyContent.
This filter modifies a given string such that words with separators are
converted to words-with-separators.
The following options are supported for Zend\Filter\Word\SeparatorToDash:
separator: A separator character. If this is not set, the default separator
is a space.$filter = new Zend\Filter\Word\SeparatorToDash(':');
// or new Zend\Filter\Word\SeparatorToDash(array('separator' => ':'));
print $filter->filter('this:is:my:content');
The above example returns this-is-my-content.
$filter = new Zend\Filter\Word\SeparatorToDash();
print $filter->filter('this is my content');
The above example returns this-is-my-content.
This filter modifies a given string such that words with separators are
converted to words-with-separators.
The following options are supported for Zend\Filter\Word\SeparatorToSeparator:
searchSeparator: The search separator character. If this is not set, the
default separator is a space.replaceSeparator: The replacement separator character. If this is not set, the
default separator is a dash (-).$filter = new Zend\Filter\Word\SeparatorToSeparator(':', '+');
print $filter->filter('this:is:my:content');
The above example returns this+is+my+content.
$filter = new Zend\Filter\Word\SeparatorToSeparator();
print $filter->filter('this is my content');
The above example returns this-is-my-content.
This filter modifies a given string such that words_with_underscores are
converted to WordsWithUnderscores.
There are no additional options for Zend\Filter\Word\UnderscoreToCamelCase:
$filter = new Zend\Filter\Word\UnderscoreToCamelCase();
print $filter->filter('this_is_my_content');
The above example returns ThisIsMyContent.
This filter modifies a given string such that words_with_underscores are
converted to words with underscores.
The following options are supported for Zend\Filter\Word\UnderscoreToSeparator:
separator: A separator character. If this is not set, the default separator
is a space.$filter = new Zend\Filter\Word\UnderscoreToSeparator('+');
// or new Zend\Filter\Word\CamelCaseToSeparator(array('separator' => '+'));
print $filter->filter('this_is_my_content');
The above example returns this+is+my+content.
$filter = new Zend\Filter\Word\UnderscoreToSeparator();
print $filter->filter('this_is_my_content');
The above example returns this is my content.
This filter modifies a given string such that words_with_underscores are
converted to words-with-underscores.
There are no additional options for Zend\Filter\Word\UnderscoreToDash:
$filter = new Zend\Filter\Word\UnderscoreToDash();
print $filter->filter('this_is_my_content');
The above example returns this-is-my-content.
How can I help you explore Laravel packages today?