Erasin 4 years ago
parent
commit
3c8d76505c
5 changed files with 86 additions and 14 deletions
  1. 46 0
      readme.md
  2. 6 0
      src/Dy/Dy.php
  3. 1 1
      src/Dy/Fenci.php
  4. 10 10
      src/Dy/Image.php
  5. 23 3
      src/Dy/Rand.php

+ 46 - 0
readme.md

@@ -0,0 +1,46 @@
+# 使用
+
+安装 `libdyutils.so` 扩展后。
+
+php项目引入ide支持,修改 `composer.json`
+
+```json
+{
+    "require": {
+        "php": ">=7.2.0"
+    },
+    "require-dev": {
+        "dyutils/ide-stubs": "dev-main"
+    },
+    "repositories": [
+        {
+            "type": "vcs",
+            "url": "git@git.dyuit.cn:dyutils/ide-stubs.git"
+        }
+    ]
+}
+```
+
+
+```bob
+
+                 +------------------+
++-------+        |                  |         +---------------+
+|       |        |                  |         |  additional   |
+|client +------> |     facade       +-------> |  facade       |
++-------+        |                  |         |               |
+                 |                  |         |               |
+                 +--+----+------+--++         +---------------+
+                    |    |      |  |
+           +--------+    |      |  +--------+
+           |          +--+      +-+         |
+           |          |           |         |
+           v          |           v         v
+       +---+---+  +---v--+   +----+--+  +---+----+
+       |       |  |      |   |       |  |        |
+       | system|  |system|   |system |  | system |
+       |       |  |      |   |       |  |        |
+       +-------+  +------+   +-------+  +--------+
+
+
+```

+ 6 - 0
src/Dy/Dy.php

@@ -0,0 +1,6 @@
+<?php
+
+/**
+ * Dy 工具包集合
+ */
+namespace Dy;

+ 1 - 1
src/Dy/Fenci.php

@@ -12,7 +12,7 @@ class Fenci
      *
      * @return array|ErrorException
      */
-    public function do(string $str, bool $hmm = false)
+    public static function do(string $str, bool $hmm = false)
     {
     }
 }

+ 10 - 10
src/Dy/Image.php

@@ -2,18 +2,18 @@
 
 namespace Dy;
 
-class Fenci
+class Image
 {
     /**
      * 尺寸缩放
      *
-     * @param string $src
-     * @param string $dest
-     * @param integer $width
-     * @param integer $height
+     * @param string $src 输入地址
+     * @param string $dest 输出地址
+     * @param integer $width 长度
+     * @param integer $height 高度
      * @return void|ErrorException
      */
-    public function resize(string $src, string $dest, int $width, int $height)
+    public static function resize(string $src, string $dest, int $width, int $height)
     {
     }
 
@@ -28,7 +28,7 @@ class Fenci
      * @param integer $height
      * @return void|ErrorException
      */
-    public function crop(string $src, string $dest, int $x, int $y, int $width, int $height)
+    public static function crop(string $src, string $dest, int $x, int $y, int $width, int $height)
     {
     }
 
@@ -42,7 +42,7 @@ class Fenci
      * @param integer $height
      * @return void|array|ErrorException
      */
-    public function captcha(string $dest, int $width, int $height)
+    public static function captcha(string $dest, int $width, int $height)
     {
     }
 
@@ -54,7 +54,7 @@ class Fenci
      * @param integer $width
      * @return void|bool|ErrorException
      */
-    public function qr(string $content, string $dest, int $width)
+    public static function qr(string $content, string $dest, int $width)
     {
     }
 
@@ -66,7 +66,7 @@ class Fenci
      * @param integer $padding
      * @return void|bool|ErrorException
      */
-    public function avatar(string $dest, int $width = 128, int $padding = 5)
+    public static function avatar(string $dest, int $width = 128, int $padding = 5)
     {
     }
 }

+ 23 - 3
src/Dy/Rand.php

@@ -10,7 +10,7 @@ class Rand
     /**
      * 随机浮点值
      *
-     * @return void
+     * @return float
      */
     public static function float()
     {
@@ -21,7 +21,7 @@ class Rand
      * 包含字符和数字
      *
      * @param integer $limit 字符串长度
-     * @return void
+     * @return string
      */
     public static function alphanumeric(int $limit)
     {
@@ -31,9 +31,29 @@ class Rand
      * 随机数字
      *
      * @param integer $limit 数字长度
-     * @return void
+     * @return integer
      */
     public static function numeric(int $limit)
     {
     }
+
+    /**
+     * twtter snowflake
+     *
+     * @param int $work_id 节点 默认 1
+     *
+     * @return integer
+     */
+    public static function snowflake($work_id = 1)
+    {
+    }
+
+    /**
+     * sony snowflake
+     *
+     * @return integer
+     */
+    public static function sonyflake()
+    {
+    }
 }