cybtow/utils

PHP应用程序的实用程序库

0.1.2 2016-10-12 10:46 UTC

This package is not auto-updated.

Last update: 2024-09-15 03:24:08 UTC


README

PHP应用程序的实用程序库。

安装

composer require cybtow/utils "^0.1"

CtrlTime 库

use Cybtow\Utils\CtrlTime;

$CtrlTime = new CtrlTime();
$CtrlTime->start();
// code here
echo $CtrlTime->time(); //show time between here and start.

FileSystem 库

  • mkdir: 创建目录。
  • rrmdir: 递归删除树目录。

GMTDateTime 库

此类继承自 PHP \DateTime。

Less 库

此类是对 oyejorge/less.php 库(https://github.com/oyejorge/less.php/tree/master)的包装

use Cybtow\Utils\Less;

$Less = new Less();
$in = 'main.less';
$out = 'main.css';

$Less->options['cache_dir'] = './cacheless';
$Less->variables['my_color'] = '#ffaabb';
$Less->parseFile($in, '', array(), $out);

Utils 库

  • slug: 为 URL 创建有效的字符串
  • getUniqId: 返回一个唯一的随机ID
  • echoVarDump: 打印变量并退出(可选)