Skip to content

Commit

Permalink
completly rewritten
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasReker committed Apr 23, 2024
1 parent 076851c commit 0309588
Show file tree
Hide file tree
Showing 14 changed files with 475 additions and 301 deletions.
65 changes: 42 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ functions.

| Version | PHP | Documentation |
|---------|------|---------------|
| ^1.0 | ^8.0 | current |
| ^2.0 | ^8.0 | current |

### Requirements

Expand All @@ -32,59 +32,78 @@ To acquire the package, utilize the composer package manager.
composer require mathiasreker/php-mbstring-extension
```

Once you have installed the mbstring extension, you can utilize its functions in your project like any other built-in
functions.

### Documentation

## mb_count_chars
## levenshtein

mb_count_chars — Return information about characters used in a string.
Calculate the Levenshtein distance between two strings.

```php
mb_count_chars(string $string, int $mode = 0, string $encoding = 'UTF-8'): array|string
\MathiasReker\PhpMbFunctions\Mbstring::levenshtein(
string $s1,
string $s2,
int $cost_ins = 1,
int $cost_rep = 1,
int $cost_del = 1
): int

```

## mb_ucwords
## ucwords

mb_ucwords — Uppercase the first character of each word in a string.
Uppercase the first character of each word in a string.

```php
mb_ucwords(
\MathiasReker\PhpMbFunctions\Mbstring::ucwords(
string $string,
string $separators = " \t\r\n\f\v",
string $encoding = 'UTF-8'
): string
```

## mb_strrev
## ucfirst

mb_strrev — Reverse a string.
Make the first character of a string uppercase.

```php
mb_strrev(string $string, string $encoding = 'UTF-8'): string
\MathiasReker\PhpMbFunctions\Mbstring::ucfirst(
string $string,
string $encoding = 'UTF-8'
): string
```

## mb_str_pad
## strrev

mb_str_pad — Pad a string to a certain length with another string.
Reverse a string.

```php
mb_str_pad(
\MathiasReker\PhpMbFunctions\Mbstring::strrev(
string $string,
int $length,
string $pad_string = " ",
int $pad_type = STR_PAD_RIGHT,
string $encoding = 'UTF-8'
): string

```

## mb_ucfirst
## count_chars

mb_ucfirst — Make a string's first character uppercase.
Returns information about characters used in a string.

```php
mb_ucfirst(string $string, string $encoding = 'UTF-8'): string
\MathiasReker\PhpMbFunctions\Mbstring::count_chars(
string $string,
int $mode,
string $encoding = 'UTF-8'
): array|string
```

## ✅ trim

Multibyte-aware trim function.

```php
\MathiasReker\PhpMbFunctions\Mbstring::trim(
string $str,
string $charlist = " \t\n\r\0\x0B"
): string
```

### Roadmap
Expand Down
19 changes: 10 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "The php-mbstring-extension is a PHP library that provides support for multibyte strings that are not covered by the standard PHP string functions.",
"license": "MIT",
"type": "library",
"version": "2.0.0",
"keywords": [
"mb_count_chars",
"mb_strrev",
Expand All @@ -26,12 +27,12 @@
"friendsofphp/php-cs-fixer": "^3.15",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6",
"rector/rector": "^0.15 || ^0.16 || ^0.17 || ^0.18 || ^0.19 || ^1.0"
"rector/rector": "^1.0"
},
"autoload": {
"files": [
"src/Helper/MultibyteString.php"
]
"psr-4": {
"MathiasReker\\PhpMbFunctions\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
Expand All @@ -50,11 +51,11 @@
"sort-packages": true
},
"scripts": {
"cs-check": "./vendor/bin/php-cs-fixer fix . --dry-run --diff",
"cs-fix": "./vendor/bin/php-cs-fixer fix .",
"phpstan": "./vendor/bin/phpstan analyse src/ --level=9",
"rector-check": "./vendor/bin/rector process --dry-run",
"rector-fix": "./vendor/bin/rector process",
"cs-check": "./vendor/bin/php-cs-fixer fix ./src --dry-run --diff",
"cs-fix": "./vendor/bin/php-cs-fixer fix ./src",
"phpstan": "./vendor/bin/phpstan analyse ./src --level=9",
"rector-check": "./vendor/bin/rector process --dry-run ./src",
"rector-fix": "./vendor/bin/rector process ./src",
"test": "./vendor/bin/phpunit --bootstrap vendor/autoload.php --colors=always tests/"
}
}
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

services:
app:
build: .
Expand Down
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@
SetList::EARLY_RETURN,
SetList::DEAD_CODE,
SetList::TYPE_DECLARATION,
SetList::INSTANCEOF,
SetList::STRICT_BOOLEANS,
]);
};
167 changes: 0 additions & 167 deletions src/Helper/MultibyteString.php

This file was deleted.

0 comments on commit 0309588

Please sign in to comment.