Package Data | |
---|---|
Maintainer Username: | mdaliyan |
Maintainer Contact: | md.aliyan@gmail.com (Mohammad Aliyan) |
Package Create Date: | 2016-10-23 |
Package Last Update: | 2020-05-26 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-22 03:16:30 |
Package Statistics | |
---|---|
Total Downloads: | 716 |
Monthly Downloads: | 3 |
Daily Downloads: | 0 |
Total Stars: | 11 |
Total Watchers: | 2 |
Total Forks: | 2 |
Total Open Issues: | 1 |
Farsi Request replaces arabic characters like ي ك ة ٤ ٥ ٦ with Farsi characters like ی ک ه ۴ ۵ ۶ in all your requests parameters automatically.
If you are building a farsi website you might end up having some users who use Arabic keyboard. These users may cause problems to your content or experience some confusion while searching among your content.
This package does two things for you:
Replaces Arabic characters with farsi standard characters
Automatically Converts Farsi or English Numbers to each other in your desired request parameters to one another. For example:
$ composer require mdaliyan/farsi-request
Add this middleware to your kernel file app/Http/Kernel.php
protected $middleware = [
...
\Mdaliyan\FarsiRequest\Middleware\ReplaceArabicCharacters::class,
];
Add this trait and two private properties to your Request Class. Then add the parameters that should have farsi or english numbers to the desired property.
use Mdaliyan\FarsiRequest\Traits\ReplaceNumbers;
class SomeRequest extends FormRequest
{
use ReplaceNumbers;
private $mustHaveEnglishNumbers = ['id','email','phone_number'];
private $mustHaveFarsiNumbers = ['post_content','author_name'];
/**
* Determine if the user is authorized to make this request.
* @return bool
*/
public function authorize()
{
return true;
}
...
Note: this feature ignores numbers inside HTML tags:
This line with the numbers 889 and an image: <img src="/media/media2.jpg">
<!-- will be converted to: -->
This line with the numbers ۸۸۹ and an image: <img src="/media/media2.jpg">