Skip to content

Commit

Permalink
feat: add strutil, curlcharescape, bashcharescape
Browse files Browse the repository at this point in the history
  • Loading branch information
kocoten1992 committed Apr 3, 2022
1 parent 3ad5a1d commit 54fc262
Show file tree
Hide file tree
Showing 9 changed files with 3,460 additions and 1 deletion.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,43 @@
# phputils
# PHPUTILS

phputils is a share utility library

## Usage

```php
use Talmp\Phputils\StrUtil;

// normal case
str_replace([1, 2], [2, 3], '12'); // '33'
StrUtil::replaceOnce([1, 2], [2, 3], '12'); // '23'
str_replace(['1', '0'], ['x110x2', 'x010'], 'a1b0c') // 'ax11x010x2bx010c'
StrUtil::replaceOnce(['1', '0'], ['x110x2', 'x010'], 'a1b0c') // 'ax110x2bx010c'

// edge case
str_replace([12, 23], [23, 45], '123') // '453'
StrUtil::replaceOnce([12, 23], [23, 45], '123') // false
str_replace([12, 23], [23, 45], '1223') // '4545'
StrUtil::replaceOnce([12, 23], [23, 45], '1223') // false
```

## Installation

Use the package manager [composer](https://getcomposer.org/) to install phputils.

```bash
composer require talmp/phputils
```

## Testing

```php
./vendor/bin/phpunit tests
```

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)
16 changes: 16 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "talmp/phputils",
"description": "TALMP utility php lib",
"type": "library",
"require-dev": {
"phpunit/phpunit": "^9.5",
"psy/psysh": "^0.11.2"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Talmp\\Phputils\\": "src/"
}
},
"require": {}
}
Loading

0 comments on commit 54fc262

Please sign in to comment.