Skip to content
This repository was archived by the owner on Jun 17, 2020. It is now read-only.

Commit 135112b

Browse files
committed
init from inhere/librarys
0 parents  commit 135112b

18 files changed

+2747
-0
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
# 对所有文件生效
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
# 对后缀名为 md 的文件生效
13+
[*.md]
14+
trim_trailing_whitespace = false
15+
16+
[*.php]
17+
indent_size = 4

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.idea/
2+
.phpintel/
3+
!README.md
4+
!.gitkeep
5+
composer.lock
6+
*.swp
7+
*.log
8+
*.pid
9+
*.patch
10+
.DS_Store

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 inhere
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# file utils for php
2+
3+
- basic filesystem operation
4+
- file read/write operation
5+
- directory operation
6+
- file finder
7+
8+
9+
## license
10+
11+
MIT

composer.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "mylib/file-utils",
3+
"type": "library",
4+
"description": "some file tool library of the php",
5+
"keywords": ["library","tool","php"],
6+
"homepage": "https://github.com/php-mylib/file-utils",
7+
"license": "MIT",
8+
"authors": [
9+
{
10+
"name": "inhere",
11+
"email": "in.798@qq.com",
12+
"homepage": "http://www.yzone.net/"
13+
}
14+
],
15+
"require": {
16+
"php": ">=7.0.0"
17+
},
18+
"autoload": {
19+
"psr-4": {
20+
"MyLib\\FileUtil\\" : "src/"
21+
}
22+
},
23+
"suggest": {
24+
"inhere/simple-print-tool": "Very lightweight data printing tools",
25+
"inhere/php-validate": "Very lightweight data validate tool",
26+
"inhere/http": "Very lightweight PSR-7 implements http message component",
27+
"inhere/console": "a lightweight php console application library."
28+
}
29+
}

example/file-finder.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: Inhere
5+
* Date: 2018/1/20 0020
6+
* Time: 23:57
7+
*/
8+
9+
require dirname(__DIR__) . '/test/boot.php';
10+
11+
// var_dump(fnmatch('.*', ".gitkeep"));die;
12+
// var_dump(glob(__DIR__ . '/{t,T}ests', GLOB_BRACE | GLOB_ONLYDIR));
13+
14+
$finder = \MyLib\FileUtil\FileFinder::create()
15+
->files()
16+
->name('*.php')
17+
// ->ignoreVCS(false)
18+
// ->ignoreDotFiles(false)
19+
// ->exclude('tmp')
20+
->notPath('tmp')
21+
->inDir(dirname(__DIR__))
22+
;
23+
24+
foreach ($finder as $file) {
25+
// var_dump($file);die;
26+
echo "+ {$file->getPathname()}\n";
27+
}
28+
29+
// print_r($finder);
30+
// var_dump($finder->count());

phpunit.xml.dist

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit backupGlobals="false"
4+
backupStaticAttributes="false"
5+
bootstrap="./tests/boot.php"
6+
colors="false"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
>
13+
<testsuites>
14+
<testsuite name="Php Library Test Suite">
15+
<directory>./tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
<filter>
20+
<whitelist>
21+
<directory suffix=".php">./src</directory>
22+
</whitelist>
23+
</filter>
24+
</phpunit>

0 commit comments

Comments
 (0)