Skip to content

Commit bf69bc0

Browse files
readme update
1 parent e1606b0 commit bf69bc0

File tree

1 file changed

+57
-74
lines changed

1 file changed

+57
-74
lines changed

README.md

Lines changed: 57 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ composer require tamedevelopers/support
316316
## Number to Words
317317
- Has three chainable methods
318318
- Can translate all the way to `vigintillion`
319+
- It's helper class can be called, using -- `NumberToWords()`
319320

320321
![Sample Units](https://raw.githubusercontent.com/tamedevelopers/support/master/thousand_units.png)
321322

@@ -328,45 +329,46 @@ composer require tamedevelopers/support
328329
### Iso
329330
- Takes param as `string` and case-insensitive
330331

331-
```
332+
```php
332333
NumberToWords::iso('nga');
333334
```
334335

335336
### Cents
336337
- Takes param as `boolean`. Default is `false`
337338
- By default, it doesn't format the decimals `.00` Must be set to true, to format if needed.
338339

339-
```
340+
```php
340341
NumberToWords::cents(true);
341342
```
342343

343344
### Value
344345
- Takes one param as `int | float | string`
345346
- If numbers is larger than a trillion `1_000_000_000_000`, then the value must be passed as a string.
346347

347-
```
348+
```php
348349
NumberToWords::value(1290);
349350
```
350351

351352
### toText
352353
- Convert number to readable words
353354
- Below, we're using the function helper method
354-
```
355+
356+
```php
355357
NumberToWords()
356-
->iso('TUR')
357-
->value('120.953')
358-
->cents(true)
359-
->toText();
358+
->iso('TUR')
359+
->value('120.953')
360+
->cents(true)
361+
->toText();
360362

361363
// Output: One hundred and twenty lira, nine hundred and fifty-three kuruş
362364
```
363365

364366
### toNumber
365367
- Convert words to number
366368
- comma `, ` is used to seperate decimals in words
367-
```
368-
use Tamedevelopers\Support\NumberToWords;
369369

370+
```php
371+
use Tamedevelopers\Support\NumberToWords;
370372

371373
NumberToWords::value('twelve million three hundred thousand, six hundred and ninety-eight')
372374
->cents(true)
@@ -395,30 +397,28 @@ Tamedevelopers\Support\Tame
395397
| mb | Custom label for MB (default: 'MB') |
396398
| kb | Custom label for KB (default: 'KB') |
397399

398-
```
400+
```php
399401
Tame()->byteToUnit(6880);
400402

401403
// Output: 7kb
402404
```
403405

404406
### unitToByte
405-
```
407+
```php
406408
Tame()->unitToByte('24mb');
407409

408410
// Output: 25165824
409411
```
410412

411413
### fileTime
412414
- Returns last edited time of the file as an - `int|false`
413-
414-
```
415+
```php
415416
Tame()->fileTime(base_path('filepath.php'));
416417
```
417418

418419
### exists
419420
- Checks if a file exists and is not a directory - `bool`
420-
421-
```
421+
```php
422422
Tame()->exists(base_path('filepath.php'));
423423
// Output: true or false
424424
```
@@ -427,7 +427,7 @@ Tame()->exists(base_path('filepath.php'));
427427
- Deletes a file from the server if it exists and does not match the restricted file name - `void`
428428
- [optional] second param <filename.extension>
429429

430-
```
430+
```php
431431
Tame()->unlink(base_path('path/to/directory/avatar.png'), 'default.png');
432432
```
433433

@@ -442,7 +442,7 @@ Tame()->unlink(base_path('path/to/directory/avatar.png'), 'default.png');
442442
| `$mask` | The character used for masking (default is `*`). |
443443

444444
#### Example:
445-
```
445+
```php
446446
Tame()->mask('[email protected]', 4, 'left');
447447
// Output: "exam***@email.com"
448448

@@ -456,7 +456,7 @@ Tame()->mask('shortstring', 4, 'center');
456456
### imageToBase64
457457
- Converts an image file to its Base64 representation. Supports local files and direct URLs - `null|string`
458458

459-
```
459+
```php
460460
Tame()->imageToBase64(base_path('path/to/image.jpg'));
461461
// Output: "data:image/jpg;base64,..." (Base64 string for the image)
462462

@@ -474,7 +474,7 @@ Tame()->imageToBase64('https://example.com/image.png', true);
474474
| use_internet | By default is set to `false`. If `true`, checks the domain using DNS (`checkdnsrr()` and `getmxrr()`) for validity. If `false`, skips domain validation (default: `false`). |
475475
| server_verify | Verifies the mail server by checking MX records (default: `false`). Only used if `use_internet` is `true`. |
476476

477-
```
477+
```php
478478
Tame()->emailValidator('[email protected]');
479479
// Output: true (Valid email with domain check using DNS)
480480

@@ -522,14 +522,14 @@ include $payment;
522522
### calPercentageBetweenNumbers
523523
- Calculates the percentage relationship between two numbers as an - `int`
524524

525-
```
525+
```php
526526
Tame()->calPercentageBetweenNumbers(100, 80);
527527
```
528528

529529
### formatNumberToNearestThousand
530530
- Formats a number to its nearest thousand, million, billion, or higher as a - `string|float|int`
531531

532-
```
532+
```php
533533
Tame()->formatNumberToNearestThousand(1500000);
534534
// Output: "1.5m"
535535
```
@@ -1058,6 +1058,7 @@ Time::getTimeZone();
10581058
use Tamedevelopers\Support\Cookie;
10591059

10601060
Cookie::set('cookie_name', 'value');
1061+
// TameCookie()->set('user', '__user');
10611062
```
10621063

10631064
### Get
@@ -1087,11 +1088,6 @@ if(Cookie::has('cookie_name')){
10871088
}
10881089
```
10891090

1090-
- or -- `Helpers Function`
1091-
```php
1092-
TameCookie()->set('user', '__user');
1093-
```
1094-
10951091
## Hash
10961092

10971093
### Hash Usage
@@ -1123,23 +1119,20 @@ password_verify('testPassword', $oldPassword);
11231119
## Asset
11241120
- Takes a param as `string` path to asset file
11251121
- Default [dir] is set to `public`
1122+
- It's helper class can be called, using -- `tasset()`
11261123

1127-
```
1124+
```php
11281125
use Tamedevelopers\Support\Asset;
11291126

11301127
Asset::asset('css/style.css');
11311128

1132-
- Returns
1133-
http://domain.com/assets/css/style.css
1134-
```
1135-
1136-
- or -- `Helpers Function`
1137-
```
1138-
tasset('css/style.css');
1129+
// - Returns
1130+
// http://domain.com/assets/css/style.css
11391131
```
11401132

11411133
## Asset Config
11421134
- Takes three param as `string`
1135+
- It's helper class can be called, using -- `config_asset()`
11431136

11441137
| params | Description |
11451138
|---------------|-----------------------------|
@@ -1148,38 +1141,37 @@ tasset('css/style.css');
11481141
| path_type | By Default is `false`, which uses absolute path for all files. While `true` will use relative path |
11491142
11501143

1151-
```
1144+
```php
11521145
use Tamedevelopers\Support\Asset;
11531146

11541147
Asset::config('public/storage');
11551148

1156-
- Returns
1157-
http://domain.com/public/storage/[asset_file]
1158-
```
1149+
// - Returns
1150+
// http://domain.com/public/storage/[asset_file]
11591151

1160-
- or -- `Helpers Function`
1161-
```
1162-
config_asset('public');
1152+
// config_asset('public');
11631153
```
11641154

11651155
### Asset Cache
11661156
- By Default, `cache` is set to `false`
11671157
- You'll see a link representation as `http://domain.com/[path_to_asset_file]?v=111111111`
11681158

1169-
```
1159+
```php
11701160
Asset::config('storage', false);
11711161

1172-
- Returns
1173-
http://domain.com/storage/[asset_file]
1162+
// - Returns
1163+
// http://domain.com/storage/[asset_file]
11741164
```
11751165

1176-
- or -- `Helpers Function`
1177-
```
1178-
asset_config('storage/main.js', true);
1179-
// Output: http://domain.com/storage/main.js?v=111111111
1166+
- or -- `using helper method`
1167+
```php
11801168

1169+
// absolute path
1170+
config_asset('storage/main.js', true);
1171+
// Output: http://domain.com/storage/main.js?v=111111111
11811172

1182-
asset_config('storage/style.css', true, true);
1173+
// relative url path
1174+
config_asset('storage/style.css', true, true);
11831175
// Output: /storage/style.css?v=111111111
11841176
```
11851177

@@ -1245,7 +1237,7 @@ Samples
12451237
```
12461238

12471239
### View Helper
1248-
- Using the helper function `tview()`
1240+
- It's helper class can be called, using -- `tview()`
12491241

12501242
```php
12511243
// set base folder for views
@@ -1268,7 +1260,7 @@ echo View::render('layout.home2', ['title' => 'Homepage']);
12681260
### Env Create
12691261
- To create an environment `.env` file. Create or ignore if exists
12701262

1271-
```
1263+
```php
12721264
use Tamedevelopers\Support\Env;
12731265

12741266
Env::createOrIgnore()
@@ -1278,21 +1270,19 @@ Env::createOrIgnore()
12781270
- To load the environment `.env` file
12791271
- Takes optional param as `string` $path
12801272

1281-
```
1273+
```php
12821274
use Tamedevelopers\Support\Env;
12831275

12841276
Env::load('path_to_env_folder')
1285-
```
1286-
1287-
- or -- `loadOrFail('optional_path')`
1288-
- Just as the name says. It'll load the `.env` file or fail with status code of 404. An error logger will also be created inside `storage/logs/orm.log`
12891277

1290-
```
1278+
// or
1279+
// Just as the name says. It'll load the `.env` file or fail with status code of 404. An error
12911280
Env::loadOrFail('path_to_env_folder')
12921281
```
12931282

12941283
### Env Update
12951284
- Returns `true|false`. Used to update env variables
1285+
- It's helper class can be called, using -- `env_update()`
12961286

12971287
| Params | Description |
12981288
|---------------|-------------------|
@@ -1301,34 +1291,27 @@ Env::loadOrFail('path_to_env_folder')
13011291
| allow_quote | `true \| false` - Default is true (Allow quotes within value) |
13021292
| allow_space | `true \| false` - Default is false (Allow space between key and value) |
13031293

1304-
```
1294+
```php
13051295
use Tamedevelopers\Support\Env;
13061296

13071297
Env::updateENV('DB_PASSWORD', 'newPassword');
1308-
```
1309-
1310-
- or -- `Helpers Function`
1311-
```
13121298
env_update('DB_CHARSET', 'utf8', false);
13131299
```
13141300

13151301
## Server
13161302
- Return instance of `Server`
1303+
- It's helper class can be called, using -- `server()`
13171304

13181305

13191306
### Get Servers
13201307
- Returns assoc arrays of Server
13211308
- `server\|domain`
13221309

1323-
```
1310+
```php
13241311
use Tamedevelopers\Support\Server;
13251312

13261313
Server::getServers();
1327-
```
1328-
1329-
- or -- `Helpers Function`
1330-
```
1331-
server()->getServers('domain');
1314+
// server()->getServers('domain');
13321315
```
13331316

13341317
### Create Custom Config
@@ -1341,14 +1324,14 @@ server()->getServers('domain');
13411324
| default | Default value if no data is found from the key |
13421325
| folder | Folder to search from and Default folder is `config` |
13431326

1344-
```
1327+
```php
13451328
use Tamedevelopers\Support\Server;
13461329

13471330
Server::config('tests.lang.email', [], 'Tests');
13481331
```
13491332

13501333
- Create our own config to extends the default
1351-
```
1334+
```php
13521335
/**
13531336
* Custom Language Handler
13541337
*
@@ -1384,8 +1367,8 @@ Base/
13841367
└── ...
13851368
```
13861369

1387-
- or -- `Helpers Function`
1388-
```
1370+
- or -- `using helpers`
1371+
```php
13891372
server()->config("en/message.{$key}", "message.{$key}", 'Lang');
13901373

13911374
server()->config("app.name");
@@ -1396,7 +1379,7 @@ server()->config("app.name");
13961379
- You can use register a folder containing all needed files
13971380
- This automatically register `Files\|Classes` in the folder and sub-folders.
13981381

1399-
```
1382+
```php
14001383
use Tamedevelopers\Support\AutoloadRegister;
14011384

14021385
AutoloadRegister::load('folder');

0 commit comments

Comments
 (0)