erfankatebsaber/tools
最新稳定版本:v1.3.2
Composer 安装命令:
composer require erfankatebsaber/tools
包简介
laravel and php tools
README 文档
README
Tools
This package include library classes with specific static function tools.
List of content
Install
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
Classes
- 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.
Config
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 'ي' => 'ی', 'ة' => 'ه', 'ك' => 'ک', ] ] ];
Parts Descriptions
auth
login_routes
You can define specific route for each guard type to redirect after logout by AuthTools::Logout().
auth_guard_name
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.
str
persian_numbers
Persian numbers to replace by StrTools::ConvertPersianNumbers or StrTools::RepairNumber functions.
Also, the StrTools::JustNumber function use this config.
wrong_numbers
Replace wrong numbers by StrTools::RepairNumber function.
Also, the StrTools::JustNumber function use this config.
empty_chars
Detect empty chars by StrTools::IsEmptyString function. One of uses of this function is to prevent deception by users (like username by uesr).
words_to_change
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.
Licence
Tis package is open-sourced library licensed under the MIT license.
统计信息
- 总下载量: 93
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-22