spaf/count-y
Composer 安装命令:
composer require spaf/count-y
包简介
Simple web-site visits counter lib
README 文档
README
Simple PHP Counter
Version: 2.0.2
To install
- Go to the folder of the project (git/code repo)
/home/user/my-code - Run commands in terminal in your code folder:
composer require spaf/count-y;
Basic usage (file-based)
require __DIR__.'/vendor/autoload.php'; use spaf\county\Counter; use spaf\county\storage\StorageFile; use spaf\simputils\PHP; PHP::init(); $c = new Counter(new StorageFile()); // In case if the StorageFile is not specified, the value will be stored in memory (StorageMemory // class). So it will exist until end of the runtime/execution. //$c = new Counter(); // If you need events, first delegate/closure is an event function, the second - event condition. The first will work, // only if the second will return TRUE, or if condition delegate/closure is not specified. //$c->add_event('My first test event', function ($value, $name) { // echo "EVENT of {$name} for value of {$value}\n"; //}, fn($v) => $v % 10 == 0 ); for ($i = 0; $i <= 105; $i++) { $c->visit(); $c->visit(); $c->visit(); } echo "Test: {$c}";
That's it. The lib right now supports really minimal functionality.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2021-07-05