const-g / cleaner
公司名称、域名等清洁工具。
1.0.1
2017-09-01 14:29 UTC
Requires
- php: >=5.3
- jbroadway/urlify: ^1.1
Requires (Dev)
- phpunit/phpunit: 5.7.19
This package is not auto-updated.
Last update: 2024-09-20 08:00:20 UTC
README
一个用于清洁域名和公司名称的库。它还可以提取公司缩写(或尝试提取)
安装
composer require const-g/cleaner
用法
它移除了不同语言中的常见“公司”术语(还不是全部)
<?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', // );
它还会移除国家名称
<?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.
可以重新组合空格缩写
<?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', // );
如果缩写存在于名称中,则会从名称中提取它,如果它与名称的其他部分匹配
<?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', // );