-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add strutil, curlcharescape, bashcharescape
- Loading branch information
1 parent
3ad5a1d
commit 54fc262
Showing
9 changed files
with
3,460 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": {} | ||
} |
Oops, something went wrong.