Skip to content

Commit 8a60fed

Browse files
committed
initial commit
0 parents  commit 8a60fed

File tree

13 files changed

+1798
-0
lines changed

13 files changed

+1798
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.env
2+
.idea
3+
/vendor/

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 SIL International, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, 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,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
test:
2+
docker-compose run test composer install
3+
docker-compose run test ./vendor/bin/phpunit tests/
4+
5+
testhost:
6+
composer install --ignore-platform-reqs
7+
bash -c "vendor/bin/phpunit tests/"

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# SIL PHP Utilities
2+
3+
A collection of utility classes share among SIL International PHP projects.
4+
5+
## Build Status
6+
7+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/silinternational/php-env/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/silinternational/php-utils/?branch=master)
8+
[![Build Status](https://scrutinizer-ci.com/g/silinternational/php-env/badges/build.png?b=develop)](https://scrutinizer-ci.com/g/silinternational/php-utils/build-status/master)
9+
10+
## Setup
11+
12+
1. Clone this repo.
13+
1. Copy `local.env.dist` to `local.env` and update github.com token as
14+
appropriate.
15+
1. Run `make test` to install dependencies and run PHPUnit tests.
16+
17+
### Makefile script
18+
19+
There is a Makefile in place to simplify common tasks.
20+
- `make test` - does `composer install` and runs phpunit tests
21+
22+
___
23+
24+
## Sil/Arrays
25+
26+
Utility class for manipulating arrays.
27+
28+
### Classes in Sil/Arrays namespace
29+
30+
1. __ArrayCollapse__: `use Sil\Array\ArrayCollapse;`
31+
32+
### Class `ArrayCollapse`
33+
34+
Util class containing a method to collapse a multi-dimensional array into a
35+
single-dimensional array. Array keys are combined using a dot to separate
36+
levels of the array. For instance:
37+
38+
```
39+
[
40+
'a' => [
41+
'x' => 'data1',
42+
],
43+
'b' => 'data2',
44+
]
45+
```
46+
47+
will be collapsed to
48+
49+
```
50+
[
51+
'a.x' => 'data1',
52+
'b' => 'data2',
53+
]
54+
```

composer.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "silinternational/php-utils",
3+
"description": "PHP library including various utility classes",
4+
"type": "library",
5+
"license": "MIT",
6+
"autoload": {
7+
"psr-4": {"Sil\\PhpUtils\\": "src/"}
8+
},
9+
"require": {
10+
"php": ">=7.0"
11+
},
12+
"require-dev": {
13+
"phpunit/phpunit": "^6.1"
14+
}
15+
}

0 commit comments

Comments
 (0)