This package include library classes with specific static function tools.
run this command:
composer require erfankatebsaber/tools
Next, add ErfanKatebSaber\tools\ToolsProvider::class
into config\app.php
file:
'providers' => [
// other providers
ErfanKatebSaber\tools\ToolsProvider::class
]
Then, run this command to create config file:
php artisan vendor:publish --tag=tools
- StrTools: This class include specific static functions to make easly string editing.
- AuthTools: This class include specific static functions to make easily use laravel auth.
After installing this package, the config file created into this path:
config/tools.php
This file content like this:
<?php
return [
'auth'=>[
'login_routes' => [
/**
* guard name => route name
*/
'web' => 'login',
/**
* if not found guard route, we redirect the user after logout to this route name
*/
'default' => 'login',
],
'auth_guard_name' => [
'web' => 'user'
]
],
'str' => [
'persian_numbers' => [
'۰' => '0',
'۱' => '1',
'۲' => '2',
'۳' => '3',
'۴' => '4',
'۵' => '5',
'۶' => '6',
'۷' => '7',
'۸' => '8',
'۹' => '9',
],
'wrong_numbers' => [
'º' => '0',
'¹' => '1',
'²' => '2',
'³' => '3',
'⁴' => '4',
'⁵' => '5',
'⁶' => '6',
'⁷' => '7',
'⁸' => '8',
'⁹' => '9'
],
'empty_chars' => [
'', // half space
],
'words_to_change' => [
// from => to
'ي' => 'ی',
'ة' => 'ه',
'ك' => 'ک',
]
]
];
You can define specific route for each guard type to redirect after logout by AuthTools::Logout()
.
You can define name for each guard type to display this via StrTools::GetGuardName('YOUR_GUARD_NAME')
.
In default config option, the result of this StrTools::GetGuardName('web')
, is user
.
Persian numbers to replace by StrTools::ConvertPersianNumbers
or StrTools::RepairNumber
functions.
Also, the StrTools::JustNumber
function use this config.
Replace wrong numbers by StrTools::RepairNumber
function.
Also, the StrTools::JustNumber
function use this config.
Detect empty chars by StrTools::IsEmptyString
function. One of uses of this function is to prevent deception by users (like username by uesr).
Replace words by StrTools::AutoChangeWord
function. One of uses of this function is prevent confusing users by store or show chars that have same appearance.
Tis package is open-sourced library licensed under the MIT license.