const-g / cleaner
Cleaning tools for company names, domains, etc.
Installs: 1 075
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3
- jbroadway/urlify: ^1.1
Requires (Dev)
- phpunit/phpunit: 5.7.19
This package is not auto-updated.
Last update: 2024-11-01 08:30:06 UTC
README
A lib to clean domains and company names. It also can extract the acronym of the company (or try to)
Install
composer require const-g/cleaner
Usage:
It removes common 'company' terms in different languages (not all yet)
<?php $company_name = \Constg\Cleaner\Clean::company_names('Google inc.'); // array( // 'original_name' => $company_name, // 'split' => array('google'), // 'clean_name' => 'google', // 'clean_name_no_space' => 'google', // );
It also removes country name
<?php $company_name = \Constg\Cleaner\Clean::company_names('Google France'); // array( // 'original_name' => $company_name, // 'split' => array('google'), // 'clean_name' => 'google', // 'clean_name_no_space' => 'google', // );
Known bug: does not cover company name like "Electricité de France" as
it will be converted to "electricite" only.
Can recompose spaced acronym
<?php $company_name = \Constg\Cleaner\Clean::company_names('B.M.W Group'); // array( // 'original_name' => 'B.M.W Group', // 'split' => array('bmw'), // 'clean_name' => 'bmw', // 'clean_name_no_space' => 'bmw', // );
If the acronym is present, then it extract it from the name, if it matches the rest of the name
<?php $company_name = \Constg\Cleaner\Clean::company_names('COMPAGNIE GENERALE DES ETABLISSEMENTS MICHELIN (C G E M)'); // array( // 'original_name' => 'COMPAGNIE GENERALE DES ETABLISSEMENTS MICHELIN (C G E M)', // 'split' => array('compagnie', 'etablissements', 'generale', 'michelin'), // 'clean_name' => 'compagnie etablissements generale michelin', // 'clean_name_no_space' => 'compagnieetablissementsgeneralemichelin', // 'acronym' => 'cgem', // );