Skip to content

Commit bc81586

Browse files
Add docs. (#4)
1 parent 0a998c9 commit bc81586

8 files changed

Lines changed: 82 additions & 18 deletions

File tree

README.md

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<a href="https://github.com/php-forge/helpers" target="_blank">
33
<img src="https://avatars.githubusercontent.com/u/103309199?s%25253D400%252526u%25253Dca3561c692f53ed7eb290d3bb226a2828741606f%252526v%25253D4" height="100px">
44
</a>
5-
<h1 align="center">Collection of Helpers for PHP.</h1>
5+
<h1 align="center">Collection of Helper for PHP.</h1>
66
<br>
77
</p>
88

@@ -45,7 +45,71 @@ or add
4545

4646
## Usage
4747

48-
[Check the documentation docs](/docs/README.md) to learn about usage.
48+
The repository contains a collection of utility functions designed to simplify common programming tasks in PHP.
49+
50+
Whether you're working on web development, data processing, or other projects, these helper functions can save you time
51+
and effort.
52+
53+
## Converts a camelCase formatted string to snake_case
54+
55+
```php
56+
<?php
57+
58+
declare(strict_types=1);
59+
60+
use PHPForge\Helper\WordFormatter;
61+
62+
$word = WordFormatter::camelCaseToSnakeCase('date_birth');
63+
```
64+
65+
## Convert a snake_case formatted string to camelCase
66+
67+
```php
68+
<?php
69+
70+
declare(strict_types=1);
71+
72+
use PHPForge\Helper\WordFormatter;
73+
74+
$word = WordFormatter::snakeCaseToCamelCase('date_birth');
75+
```
76+
77+
## Converts a string to words with capitalized first letters
78+
79+
```php
80+
<?php
81+
82+
declare(strict_types=1);
83+
84+
use PHPForge\Helper\WordFormatter;
85+
86+
$word = WordFormatter::capitalizeToWords('Date Birth');
87+
```
88+
89+
## Generate ramdon pasword
90+
91+
```php
92+
<?php
93+
94+
declare(strict_types=1);
95+
96+
use PHPForge\Helper\Password;
97+
98+
$password = Password::generate(8);
99+
```
100+
101+
102+
## Get all timezones
103+
104+
```php
105+
<?php
106+
107+
declare(strict_types=1);
108+
109+
use PHPForge\Helper\Timezone;
110+
111+
$timezones = Timezone::getAll();
112+
```
49113

50114
## Testing
51115

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "php-forge/helpers",
2+
"name": "php-forge/helper",
33
"type": "library",
4-
"description": "Collection of Helpers for PHP.",
4+
"description": "Collection of Helper for PHP.",
55
"keywords": [
66
"php-forge",
7-
"helpers"
7+
"helper"
88
],
99
"license": "mit",
1010
"require": {
@@ -19,12 +19,12 @@
1919
},
2020
"autoload": {
2121
"psr-4": {
22-
"PHPForge\\Helpers\\": "src"
22+
"PHPForge\\Helper\\": "src"
2323
}
2424
},
2525
"autoload-dev": {
2626
"psr-4": {
27-
"PHPForge\\Helpers\\Tests\\": "tests"
27+
"PHPForge\\Helper\\Tests\\": "tests"
2828
}
2929
},
3030
"extra": {

src/Password.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace PHPForge\Helpers;
5+
namespace PHPForge\Helper;
66

77
use function array_map;
88
use function implode;

src/TimeZone.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace PHPForge\Helpers;
5+
namespace PHPForge\Helper;
66

77
use DateTime;
88
use DateTimeZone;

src/WordFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace PHPForge\Helpers;
5+
namespace PHPForge\Helper;
66

77
use function explode;
88
use function implode;

tests/PasswordTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace PHPForge\Helpers\Tests;
5+
namespace PHPForge\Helper\Tests;
66

7-
use PHPForge\Helpers\Password;
7+
use PHPForge\Helper\Password;
88
use PHPUnit\Framework\TestCase;
99

1010
final class PasswordTest extends TestCase

tests/TimeZoneTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace PHPForge\Helpers\Tests;
5+
namespace PHPForge\Helper\Tests;
66

7-
use PHPForge\Helpers\TimeZone;
7+
use PHPForge\Helper\TimeZone;
88
use PHPUnit\Framework\TestCase;
99

1010
final class TimeZoneTest extends TestCase
@@ -41,12 +41,12 @@ public function testGetAllReturnsOrderedTimeZones()
4141
$prevOffset = null;
4242

4343
foreach ($timeZones as $timeZone) {
44-
// Verifica que el offset sea mayor o igual al offset anterior
44+
// verify that the offset is greater than or equal to the previous offset
4545
if ($prevOffset !== null) {
4646
$this->assertGreaterThanOrEqual($prevOffset, $timeZone['offset']);
4747
}
4848

49-
// Verifica que el array tenga las claves correctas
49+
// verify that the array contains the expected keys
5050
$this->assertArrayHasKey('timezone', $timeZone);
5151
$this->assertArrayHasKey('name', $timeZone);
5252
$this->assertArrayHasKey('offset', $timeZone);

tests/WordFormatterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace PHPForge\Helpers\Tests;
5+
namespace PHPForge\Helper\Tests;
66

7-
use PHPForge\Helpers\WordFormatter;
7+
use PHPForge\Helper\WordFormatter;
88
use PHPUnit\Framework\TestCase;
99

1010
final class WordFormatterTest extends TestCase

0 commit comments

Comments
 (0)