getarabictimepackage / arabic-time
A Laravel package to convert time to Arabic time periods.
Requires
- php: >=7.3
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- nesbot/carbon: ^2.0
This package is not auto-updated.
Last update: 2024-12-31 14:08:30 UTC
README
If your package doesn't include a configuration file that users can publish, you can remove that part from the README. Here's the updated version:
Arabic Time Package
Arabic Time Package is a PHP package that helps you display time in Arabic format. It's designed to be easy to integrate into your Laravel applications, but it can be used in any PHP project.
Features
- Display time in Arabic language format.
- Easy integration with Blade templates in Laravel.
- Supports different time formats and customization.
Installation
You can install the package via Composer:
composer require getarabictimepackage/arabic-time
Usage
Basic Usage
After installing the package, you can use it directly in your PHP code to display the current time in Arabic format:
use GetArabicTimePackage\ArabicTime\ArabicTime; echo ArabicTime::now(); // Displays the current time in Arabic
Custom Time Formatting
You can also format the time according to your needs:
use GetArabicTimePackage\ArabicTime\ArabicTime; $time = new DateTime('now'); echo ArabicTime::format($time, 'H:i'); // Displays time in Arabic with a custom format
Blade Directives (Laravel Only)
If you're using Laravel, you can utilize the provided Blade directives for easier integration:
-
Register the service provider in
config/app.php
(if not auto-discovered): -
Register the service provider in Laravel 11 bootstrap/providers.php
'providers' => [ // Other service providers... GetArabicTimePackage\ArabicTime\ArabicTimeServiceProvider::class, ],
-
Use the directives in your Blade views:
@arabicTime($time) // Converts the given DateTime instance to Arabic time
Example in Blade
<!DOCTYPE html> <html lang="ar"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Arabic Time Example</title> </head> <body> <h1>الوقت الحالي: @arabicTime(now())</h1> </body> </html>
Contributing
Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas.
License
This package is open-sourced software licensed under the MIT license.