keboola / sanitizer
Column name sanitizer
Installs: 85 980
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 18
Forks: 0
Open Issues: 0
Requires
- php: >=5.6
Requires (Dev)
- jakub-onderka/php-parallel-lint: ^1.0
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^3.4
This package is auto-updated.
Last update: 2024-11-30 01:57:45 UTC
README
Sanitizes strings so that they are usable as column identifiers in Keboola Connection Storage.
Usage
Method sanitize
generates a string which is a safe column name:
use Keboola\Utils\Sanitizer\ColumnNameSanitizer;
$sanitized = ColumnNameSanitizer::sanitize('my column name');
echo $sanitized; // prints 'my_column_name'
Method toAscii
removes converts accented characters non-accented to fit into basic ASCII charset:
use Keboola\Utils\Sanitizer\ColumnNameSanitizer;
$sanitized = ColumnNameSanitizer::toAscii('test-vn-đá cuội');
echo $sanitized; // prints 'test_vn_da_cuoi'
License
MIT licensed, see LICENSE file.