Skip to content

Commit 9a5a633

Browse files
committed
addd smoe new classs
1 parent 61385f5 commit 9a5a633

File tree

9 files changed

+200
-3
lines changed

9 files changed

+200
-3
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
# Check for updates to GitHub Actions every weekday
13+
interval: "daily"

.github/workflows/php.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Unit-tests
2+
3+
on: [push]
4+
5+
jobs:
6+
test:
7+
name: Test on php ${{ matrix.php}} and ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
timeout-minutes: 10
10+
strategy:
11+
fail-fast: true
12+
matrix:
13+
php: [7.3, 7.4, 8.0] #
14+
os: [ubuntu-latest, macOS-latest] # windows-latest,
15+
include:
16+
- os: 'ubuntu-latest'
17+
php: '7.2'
18+
phpunit: '8.5.13'
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
# usage refer https://github.com/shivammathur/setup-php
25+
- name: Setup PHP
26+
timeout-minutes: 5
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php}}
30+
tools: pecl, php-cs-fixer, phpunit:${{ matrix.phpunit }}
31+
extensions: mbstring, dom, fileinfo, mysql, openssl, igbinary, redis # , swoole-4.4.19 #optional, setup extensions
32+
ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
33+
coverage: none #optional, setup coverage driver: xdebug, none
34+
35+
- name: Display Env
36+
run: env
37+
38+
- name: Install dependencies
39+
run: composer install --no-progress --no-suggest
40+
41+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
42+
# Docs: https://getcomposer.org/doc/articles/scripts.md
43+
44+
- name: Run test suite
45+
run: phpunit

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Tag-release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
release:
10+
name: Test on php ${{ matrix.php}}
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 10
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
php: [7.3]
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Set ENV for github-release
23+
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
24+
run: |
25+
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
26+
echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
27+
28+
# usage refer https://github.com/shivammathur/setup-php
29+
- name: Setup PHP
30+
timeout-minutes: 5
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php}}
34+
tools: pecl, php-cs-fixer, phpunit
35+
extensions: mbstring, dom, fileinfo, mysql, openssl # , swoole-4.4.19 #optional, setup extensions
36+
ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
37+
coverage: none #optional, setup coverage driver: xdebug, none
38+
39+
- name: Install dependencies # eg: v1.0.3
40+
run: |
41+
tag1=${GITHUB_REF#refs/*/}
42+
echo "release tag: ${tag1}"
43+
composer install --no-progress --no-suggest
44+
45+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
46+
# Docs: https://getcomposer.org/doc/articles/scripts.md
47+
48+
# - name: Build phar and send to github assets
49+
# run: |
50+
# echo $RELEASE_TAG
51+
# echo $RELEASE_NAME
52+
# php -d phar.readonly=0 bin/kite phar:pack -o kite-${RELEASE_TAG}.phar --no-progress
53+
# php kite-${RELEASE_TAG}.phar -V
54+
55+
# https://github.com/actions/create-release
56+
- uses: meeDamian/github-release@2.0
57+
with:
58+
gzip: false
59+
token: ${{ secrets.GITHUB_TOKEN }}
60+
tag: ${{ env.RELEASE_TAG }}
61+
name: ${{ env.RELEASE_TAG }}
62+
# files: kite-${{ env.RELEASE_TAG }}.phar

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Extlib
2+
3+
[![License](https://img.shields.io/packagist/l/toolkit/extlib.svg?style=flat-square)](LICENSE)
4+
[![Php Version](https://img.shields.io/badge/php-%3E=7.1.0-brightgreen.svg?maxAge=2592000)](https://packagist.org/packages/toolkit/extlib)
5+
[![Latest Stable Version](http://img.shields.io/packagist/v/toolkit/extlib.svg)](https://packagist.org/packages/toolkit/extlib)
6+
[![Actions Status](https://github.com/php-toolkit/extlib/workflows/Unit-tests/badge.svg)](https://github.com/php-toolkit/extlib/actions)
7+
8+
Some useful extends library for php.
9+
10+
## Install
11+
12+
```bash
13+
composer require toolkit/extlib
14+
```
15+
16+
## Usage
17+
18+
19+
## License
20+
21+
MIT

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"require": {
2121
"php": ">7.1.0",
2222
"toolkit/cli-utils": "^1.0",
23+
"toolkit/fsutil": "^1.0",
2324
"toolkit/stdlib": "^1.0"
2425
},
2526
"autoload": {

src/IO/MemoryIO.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
4+
namespace Toolkit\Extlib\IO;
5+
6+
/**
7+
* Class MemoryIO
8+
* @package Toolkit\Extlib\IO
9+
*/
10+
class MemoryIO
11+
{
12+
13+
}

src/IO/StreamIO.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
4+
namespace Toolkit\Extlib\IO;
5+
6+
/**
7+
* Class StreamIO
8+
* @package Toolkit\Extlib\IO
9+
*/
10+
class StreamIO
11+
{
12+
13+
}

src/Language.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
use InvalidArgumentException;
1414
use IteratorAggregate;
1515
use RangeException;
16-
use Toolkit\File\FileSystem;
17-
use Toolkit\ObjUtil\Obj;
18-
use Toolkit\StrUtil\Str;
16+
use Toolkit\FsUtil\FileSystem;
17+
use Toolkit\Stdlib\Obj;
18+
use Toolkit\Stdlib\Str;
1919
use Traversable;
2020
use function count;
2121
use function explode;

test/bootstrap.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php declare(strict_types=1);
2+
/**
3+
* phpunit --bootstrap tests/boot.php tests
4+
*/
5+
6+
error_reporting(E_ALL | E_STRICT);
7+
date_default_timezone_set('Asia/Shanghai');
8+
9+
$libDir = dirname(__DIR__);
10+
$npMap = [
11+
'Toolkit\\ExtlibTest\\' => $libDir . '/test/',
12+
'Toolkit\\Extlib\\' => $libDir . '/src/',
13+
];
14+
15+
spl_autoload_register(static function ($class) use ($npMap) {
16+
foreach ($npMap as $np => $dir) {
17+
$file = $dir . str_replace('\\', '/', substr($class, strlen($np))) . '.php';
18+
19+
if (file_exists($file)) {
20+
include $file;
21+
}
22+
}
23+
});
24+
25+
if (is_file(dirname(__DIR__, 3) . '/autoload.php')) {
26+
require dirname(__DIR__, 3) . '/autoload.php';
27+
} elseif (is_file(dirname(__DIR__) . '/vendor/autoload.php')) {
28+
require dirname(__DIR__) . '/vendor/autoload.php';
29+
}

0 commit comments

Comments
 (0)