A PHP common toolkit.
- ๅธธ็จPHPๅทฅๅ ทๅฝๆฐๅบ
ๅ็ปๆ ๆฐไธช้กน็ฎๆฒๆท็ๅทฅๅ ทๅฝๆฐ๏ผๆๅ ด่ถฃ็ๅฏไปฅไธ่ตทๆฅ็ปดๆค๏ผ ้ฎ็ฎฑ๏ผservice#vipkwd.com
- PHP 7.0+
- composer
ๅฎ่ฃ ไฝฟ็จ[Check it out on packagist.org]
composer require vipkwd/utils
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd
vipkwd/utils 3.2.0
Usage:
command [options] [arguments]
Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
completion Dump the shell completion script
dump Show the class list of Vipkwd/utils package
help Display help for a command
list List commands
load
load:assets Install/update assetes for utils
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd dump
Idx | Namespace | Class | Method | Type | Arguments | Eg | Comment |
---|---|---|---|---|---|---|---|
1 | Vipkwd\Utils | Algorithm | 10 | :) | :) | :) | ็ปๅ ธๆๅบ/ๆฅๆพ็ฎๆณ |
2 | Vipkwd\Utils | Async | 4 | :) | :) | :) | PHPๅผๆญฅๅ่ฐ |
3 | Vipkwd\Utils | Calendar | 9 | :) | :) | :) | ้ดใ้ณๅๆณ |
4 | Vipkwd\Utils | Callback | 11 | :) | :) | :) | PHP callable tools |
5 | Vipkwd\Utils | Color | 3 | :) | :) | :) | Rgb/Hex้ข่ฒๅผๅค็ |
6 | Vipkwd\Utils | Crypt | 15 | :) | :) | :) | # |
7 | Vipkwd\Utils | Dev | 8 | :) | :) | :) | ๅผๅ่ฐ่ฏๅฝๆฐ |
8 | Vipkwd\Utils | Excel | 5 | :) | :) | :) | Excel่กจๆ ผๅทฅๅ ท |
9 | Vipkwd\Utils | Fenci | 6 | :) | :) | :) | ไธญๆๅ่ฏ็ปไปถ |
10 | Vipkwd\Utils | Http | 6 | :) | :) | :) | http่ฏทๆฑ |
11 | Vipkwd\Utils | Idcard | 15 | :) | :) | :) | ่ฏไปถๅท็ (ๅคง้/ๆธฏ/ๆพณ/ๅฐ) |
12 | Vipkwd\Utils | Ip | 8 | :) | :) | :) | # |
13 | Vipkwd\Utils | Page | 3 | :) | :) | :) | ้็จๅ้กต็ฑป |
14 | Vipkwd\Utils | Position | 12 | :) | :) | :) | ็ป็บฌๅบฆๆไฝ็ฑป |
15 | Vipkwd\Utils | Tools | 18 | :) | :) | :) | ๅธธ็จๅทฅๅ ท้ๅ |
16 | Vipkwd\Utils | Validate | 32 | :) | :) | :) | (regexp)้ช่ฏ็ฑป |
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd dump color
Idx | Namespace | Class | Method | Type | Arguments | Eg | Comment |
---|---|---|---|---|---|---|---|
1 | Vipkwd\Utils | Color | colorHexFix | static | $color | [โ] | 16่ฟๅถ่ฒๅผๆฃๆต/ไฟฎ่กฅ |
2 | Vipkwd\Utils | Color | hex2rgb | static | $color | [โ] | 16่ฟๅถ่ฒๅผ่ฝฌRGBๆฐๅผ |
3 | Vipkwd\Utils | Color | rgb2hex | static | $r=255, $g=255, $b=255 | [โ] | RGBๆฐๅผ่ฝฌ16่ฟๅถ่ฒๅผ |
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd dump -d
Idx | Dir | Namespace | Cli |
---|---|---|---|
1 | Db | \Vipkwd\Utils\Db | php vendor/bin/vipkwd dump Db |
2 | Image | \Vipkwd\Utils\Image | php vendor/bin/vipkwd dump Image |
3 | Libs | \Vipkwd\Utils\Libs | php vendor/bin/vipkwd dump Libs |
4 | MediumAI | \Vipkwd\Utils\MediumAI | php vendor/bin/vipkwd dump MediumAI |
5 | Mq | \Vipkwd\Utils\Mq | php vendor/bin/vipkwd dump Mq |
6 | System | \Vipkwd\Utils\System | php vendor/bin/vipkwd dump System |
7 | Type | \Vipkwd\Utils\Type | php vendor/bin/vipkwd dump Type |
8 | Wx | \Vipkwd\Utils\Wx | php vendor/bin/vipkwd dump Wx |
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd dump Db
Idx | Namespace | Class | Method | Type | Arguments | Eg | Comment |
---|---|---|---|---|---|---|---|
1 | Vipkwd\Utils\Db | Mongo | 31 | :) | :) | :) | Mongo |
2 | Vipkwd\Utils\Db | Mysql | 36 | :) | :) | :) | Mysql |
3 | Vipkwd\Utils\Db | Redis | 85 | :) | :) | :) | Redis |
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd dump Db.mysql
Idx | Namespace | Class | Method | Type | Arguments | Eg | Comment |
---|---|---|---|---|---|---|---|
1 | Vipkwd\Utils\Db | Mysql | instance | static | $options | [x] | ๅไพๅ ฅๅฃ |
2 | Vipkwd\Utils\Db | Mysql | action | public | $callback | [x] | ๅฏๅจไธไธชไบๅก |
3 | Vipkwd\Utils\Db | Mysql | avg | public | [x] | ่ทๅพๆไธชๅๅญๆฎต็ๅนณๅๅผ | |
4 | Vipkwd\Utils\Db | Mysql | beginDebug | public | [x] | ๅผๅฏ่ฐ่ฏๆจกๅผ | |
5 | Vipkwd\Utils\Db | Mysql | chunk | public | $limit=10, $callback, $stime=null | [x] | chunkๅๅๆไฝๆฐๆฎ |
6 | Vipkwd\Utils\Db | Mysql | count | public | [x] | ่ทๅๆฐๆฎ่กจไธญ็่กๆฐ | |
7 | Vipkwd\Utils\Db | Mysql | data | public | $data | [x] | ่ฎพ็ฝฎๆไฝ็ฎๆ ๆฐๆฎ |
8 | Vipkwd\Utils\Db | Mysql | debugLog | public | [x] | ่ทๅ่ฐ่ฏๆจกๅผไธSQL่ฏญๅฅ | |
9 | Vipkwd\Utils\Db | Mysql | delete | public | [x] | ๅ ้ค่กจไธญๆกไปถๅ ็ๆฐๆฎ | |
10 | Vipkwd\Utils\Db | Mysql | field | public | $fields="*" | [x] | ้ ็ฝฎๆฅ่ฏขๅญๆฎต |
11 | Vipkwd\Utils\Db | Mysql | get | public | [x] | ่ฟๅๆกไปถๅ ็ไธ่กๆฐๆฎ | |
12 | Vipkwd\Utils\Db | Mysql | group | public | $group | [x] | GROUP |
13 | Vipkwd\Utils\Db | Mysql | has | public | [x] | ๆฃๆตๆกไปถๅ ๆฐๆฎๆฏๅฆๅญๅจ | |
14 | Vipkwd\Utils\Db | Mysql | having | public | $havingArr | [x] | having |
15 | Vipkwd\Utils\Db | Mysql | info | public | [x] | ่ทๅๆฐๆฎๅบ่ฟๆฅไฟกๆฏ | |
16 | Vipkwd\Utils\Db | Mysql | insert | public | $primaryKey=null | [x] | ๆๅ ฅๆฐๆฎๅฐ่กจไธญ |
17 | Vipkwd\Utils\Db | Mysql | insertAll | public | [x] | ๆน้ๆๅ ฅๆฐๆฎๅฐ่กจไธญ | |
18 | Vipkwd\Utils\Db | Mysql | join | public | $join=[] | [x] | ้ ็ฝฎ้พ่กจๅ ณ็ณป |
19 | Vipkwd\Utils\Db | Mysql | last | public | [x] | ่ทๅๆๅไธๆกๆฅ่ฏข่ฏญๅฅ | |
20 | Vipkwd\Utils\Db | Mysql | lastInsertId | public | [x] | ่ฟๅๆๅๆๅ ฅ็่กID | |
21 | Vipkwd\Utils\Db | Mysql | limit | public | $limit=10, $offset=0 | [x] | ๆๅ็งป้่ทๅlimitๆกๆฐ่ฎฐๅฝ |
22 | Vipkwd\Utils\Db | Mysql | log | public | [x] | ่ทๅๅๅบๆๆSQL | |
23 | Vipkwd\Utils\Db | Mysql | max | public | [x] | ่ทๅพๆไธชๅไธญ็ๆๅคง็ๅผ | |
24 | Vipkwd\Utils\Db | Mysql | min | public | [x] | ่ทๅพๆไธชๅไธญ็ๆๅฐ็ๅผ | |
25 | Vipkwd\Utils\Db | Mysql | order | public | $order | [x] | order by |
26 | Vipkwd\Utils\Db | Mysql | page | public | $page=1, $limit=10 | [x] | ๆ้กต็ ่ทๅlimitๆกๆฐ่ฎฐๅฝ |
27 | Vipkwd\Utils\Db | Mysql | pdo | public | [x] | ่ทๅๆ ๅPDOๆฅๅฃ | |
28 | Vipkwd\Utils\Db | Mysql | query | public | $sql | [x] | |
29 | Vipkwd\Utils\Db | Mysql | random | public | [x] | ้ๆบ่ทๅๆกไปถๅ ๆฐๆฎ | |
30 | Vipkwd\Utils\Db | Mysql | raw | public | $expression, $map=[] | [x] | ็ๆๅๅงSQL่กจ่พพๅผไผๅ่ฏญๅฅ |
31 | Vipkwd\Utils\Db | Mysql | replace | public | $columns | [x] | ๆน้ๆฟๆขๅญๆฎต็ๆฐๆฎ |
32 | Vipkwd\Utils\Db | Mysql | select | public | $callback=null | [x] | ๅคๆกๆฅ่ฏข๏ผๆฏๆๅ่ฐ้ๅ่ทๅ |
33 | Vipkwd\Utils\Db | Mysql | sum | public | [x] | ๆไธชๅๅญๆฎต็ธๅ | |
34 | Vipkwd\Utils\Db | Mysql | table | public | $tbName | [x] | ๅๆข/้ๆฉๆฐๆฎ่กจ |
35 | Vipkwd\Utils\Db | Mysql | update | public | $data=[] | [x] | ไฟฎๆน่กจๆฐๆฎ |
36 | Vipkwd\Utils\Db | Mysql | where | public | $where=[] | [x] | ่ฎพ็ฝฎๆไฝ่ฟๆปคๆกไปถ |
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd dump color -m rgb2hex
Idx | Namespace | Class | Method | Type | Arguments | Eg | Comment |
---|---|---|---|---|---|---|---|
1 | Vipkwd\Utils | Color | rgb2hex | static | $r=255, $g=255, $b=255 | [โ] | RGBๆฐๅผ่ฝฌ16่ฟๅถ่ฒๅผ |
/**
* RGBๆฐๅผ่ฝฌ16่ฟๅถ่ฒๅผ
*
* -e.g: phpunit("Color::rgb2hex",[255,255,255]);
* -e.g: phpunit("Color::rgb2hex",[1,10,100]);
* -e.g: phpunit("Color::rgb2hex",[9,0,1]);
*
* @param integer $r
* @param integer $g
* @param integer $b
* @return string
*/
Struct: \Vipkwd\Utils\Color::rgb2hex(
$r=255,
$g=255,
$b=255
);
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd dump color -m rgb2hex --eg
[01] \Vipkwd\Utils\Color::rgb2hex(255, 255, 255); //<string:>โ#ffffffโ
[02] \Vipkwd\Utils\Color::rgb2hex(1, 10, 100); //<string:>โ#010a64โ
[03] \Vipkwd\Utils\Color::rgb2hex(9, 0, 1); //<string:>โ#090001โ
------------------------------------------------------------------------------------
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd dump ip -m getInfo --eg
[01] \Vipkwd\Utils\Ip::getInfo("1.2.4.8"); //array(8) {
[state] => โไธญๅฝโ
[region] => โ-โ
[province] => โๅไบฌโ
[city] => โๅไบฌๅธโ
[isp] => โCNNICๆๅจไบ่งฃๆ(CDNS.CN)ๅ
จ็Anycast่็นโ
[ip] => โ1.2.4.8โ
[beginip] => โ1.2.4.0โ
[endip] => โ1.2.4.255โ
}
[02] \Vipkwd\Utils\Ip::getInfo("127.0.0.1"); //array(8) {
[state] => โ-โ
[region] => โ-โ
[province] => โ-โ
[city] => โๅ
็ฝIPโ
[isp] => โๅ
็ฝIPโ
[ip] => โ127.0.0.1โ
[beginip] => โ127.0.0.1โ
[endip] => โ127.0.0.1โ
}
[03] \Vipkwd\Utils\Ip::getInfo("120.235.131.155"); //array(8) {
[state] => โไธญๅฝโ
[region] => โ-โ
[province] => โๅนฟไธ็โ
[city] => โๆ ๅทๅธโ
[isp] => โ็งปๅจโ
[ip] => โ120.235.131.155โ
[beginip] => โ120.235.129.0โ
[endip] => โ120.235.141.255โ
}
[04] \Vipkwd\Utils\Ip::getInfo("236.230.35.38/29"); //array(8) {
[state] => โ-โ
[region] => โ-โ
[province] => โ-โ
[city] => โๅ
็ฝIPโ
[isp] => โๅ
็ฝIPโ
[ip] => โ236.230.35.38โ
[beginip] => โ225.0.0.0โ
[endip] => โ239.255.255.255โ
}
------------------------------------------------------------------------------------
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd dump 10.musume.com
[Notice] Undefined constant "\Vipkwd\Utils\10\Musume\Com::class" with /data/wwwroot/10musume.com/vendor\vipkwd\utils/src/10/Musume/Com.php
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd dump porn
[Notice] Undefined constant "\Vipkwd\Utils\Porn::class" with /data/wwwroot/10musume.com/vendor\vipkwd\utils/src/Porn.php
yipeng@mbp vipkwd-framework % php vendor/bin/vipkwd load:assets
You must use option `-c https://domain.com` manually enter your own cdn address or specify one from the list of below
But have found the following cdn maps, please choose[index/url] one of them? [http://vipkwd.eu5.net]:
[0] http://vipkwd.eu5.net
[1] http://vipkwd.totalh.net
[2] http://dl.vipkwd.com
[3] http://vipkwd.byethost13.com
[4] quit
>
-----------------------------------------------------------------------------------------------------------------
--- CDN Ping( http://vipkwd.eu5.net )๏ผOk
--- CDN Maps( http://vipkwd.eu5.net/vipkwd-cdn/maps.php ): Ok
-----------------------------------------------------------------------------------------------------------------
--> [1] 55fc1266e3821b3dd3d1a533dcd9c113 ttfs/1.ttf
โ-ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท (Download completed)
--> [2] 45d3bab54f8d612976187570fbde8e3a ttfs/2.ttf
โ-ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท (Download completed)
--> [3] 08774b94f4feaedebb6072251124f8aa ttfs/3.ttf
โ-ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท (Download completed)
--> [4] 629a55a7e793da068dc580d184cc0e31 ttfs/4.ttf
โ-ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท (Download completed)
--> [5] ac3f799d5bbaf5196fab15ab8de8431c ttfs/5.ttf
โ-ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท (Download completed)
--> [6] 1c5965c2b1dcdea439b54c3ac60cee38 ttfs/6.ttf
โ-ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท (Download completed)
--> [7] f80465e9d8cea2b48da01f5aba236b59 ttfs/msyh.ttf
โ-ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท (Download completed)
--> [8] 084fe7a7c7c24816842b618a3e839290 qqwry.dat
โ-ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท (Download completed)
- ๆดๅคไฝฟ็จ่ฏทๅ็ งexample็จไพ
ๆฌข่ฟStar
๏ผๆฌข่ฟFork