https://github.com/maherelgamil/arabicdatetime
An easy and useful tool to get Arabic date with Arabic characters for Laravel.
https://github.com/maherelgamil/arabicdatetime
composer hijri hijri-months laravel locale-language php
Last synced: 10 months ago
JSON representation
An easy and useful tool to get Arabic date with Arabic characters for Laravel.
- Host: GitHub
- URL: https://github.com/maherelgamil/arabicdatetime
- Owner: maherelgamil
- License: mit
- Created: 2014-12-09T15:40:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-06-22T12:33:10.000Z (about 5 years ago)
- Last Synced: 2025-08-21T15:15:41.673Z (10 months ago)
- Topics: composer, hijri, hijri-months, laravel, locale-language, php
- Language: PHP
- Homepage: https://github.com/maherelgamil/arabicdatetime
- Size: 60.5 KB
- Stars: 41
- Watchers: 3
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-arabic - arabicdatetime - Easy and useful tool to get arabic date with arabic characters for laravel 5.1. (Programming Languages)
- awesome-arabic - arabicdatetime - Easy and useful tool to get arabic date with arabic characters for laravel 5.1. (Programming Languages)
README
# ArabicDateTime
Easy and useful tool to generate arabic or hijri date with multi-language support for laravel .
[](https://packagist.org/packages/maherelgamil/arabicdatetime)
[](https://packagist.org/packages/maherelgamil/arabicdatetime)
[](https://packagist.org/packages/maherelgamil/arabicdatetime)
[](https://packagist.org/packages/maherelgamil/arabicdatetime)
[](https://packagist.org/packages/maherelgamil/arabicdatetime)
[](https://styleci.io/repos/27773486)
## Installation
### Composer
Add Laravel ArabicDateTime to your `composer.json` file.
```bash
composer require maherelgamil/arabicdatetime
```
Run `composer install` to get the latest version of the package.
### Laravel 5.* only
ArabicDateTime comes with a service provider for Laravel 4. You'll need to add it to your `composer.json` as mentioned in the above steps, then register the service provider with your application.
Open `app/config/app.php` and find the `providers` key. Add `Arabicdatetime\ArabicdatetimeServiceProvider` to the array.
```php
...
Maherelgamil\Arabicdatetime\ArabicdatetimeServiceProvider::class
...
```
You can also add an alias to the list of class aliases in the same app.php
```php
...
'Arabicdatetime' => Maherelgamil\Arabicdatetime\Facades\Arabicdatetime::class
...
```
Now . publish vendor
```
php artisan vendor:publish
```
## Useage
### Get date from unixtime
```php
//$arabDateTime->date({unixtime} , {mode} , {schema} , {numericMode});
//This function take 4 Parameters :
//1- unixtime : ex '1418123530'
//2- mode :
0 for Arabic date
1 for Hijri date
//3- schema : as `php` schema , you can read this page for more info. : http://php.net/manual/en/function.date.php
//4- numericMode takes two types 'indian' or 'arabic' and 'arabic' is default
//5 - Create a Arabicdatetime instance
$arabDateTime = new Arabicdatetime();
//for Gregorian date with Englsih numbers
$arabDateTime->date(1418123530 , 0);
//for Hijri date with indian numbers
$arabDateTime->date(1418123530 , 1 , 'd / m / y ' ,'indian');
//for Hijri date, there is an optional correction, You can add or subtract days with plus and minus
$arabDateTime->setCorrection('+1');
$arabDateTime->setCorrection('-1');
```
### Get Days with locale language
```PHP
$arabDateTime->getDays();
```
### Get Arabic Days
```PHP
$arabDateTime->getArabicDays();
```
### Get Months With locale language
```PHP
$arabDateTime->getMonths();
```
### Get Arabic Months
```PHP
$arabDateTime->getArabicMonths();
```
### Get Hijri Months with locale language
```PHP
$arabDateTime->getHijriMonths();
```
### Get Hijri Months
```PHP
$arabDateTime->getArabicHijriMonths();
```
### Get remainnig time
```php
$arabDateTime->remainingTime(1418123530);
```
### Get left time
```php
$arabDateTime->leftTime(1418123530);
```
### Get left or remaining time
```php
$arabDateTime->leftRemainingTime(1418123530);
```
## License
ArabicDateTime is an open-sourced laravel package licensed under the [MIT](LICENSE) license