alfian / indo-date-format
There is no license information available for the latest version (v1.0.0) of this package.
Format tanggal Indonesia untuk Laravel
v1.0.0
2025-06-19 09:23 UTC
Requires
- php: ^8.0
This package is auto-updated.
Last update: 2025-06-20 02:12:24 UTC
README
Format tanggal Indonesia untuk Laravel
Mengubah tanggal dari format
dd/mm/YYYY
menjadi formatDD MMMM YYYY
(misalnya01/01/2025
→01 Januari 2025
) dalam aplikasi Laravel.
📋 Daftar Isi
🚀 Fitur
- Konversi tanggal
dd/mm/YYYY
ke formatDD MMMM YYYY
berbahasa Indonesia. - Autodiscoverable di Laravel 5.5+.
- Dukungan PHP 7.4, 8.0 ke atas.
🔧 Instalasi
-
Via Packagist
composer require alfian/indo-date-format
-
Via Path Repository (local development)
- Tambahkan di
composer.json
proyek:"repositories": [ { "type": "path", "url": "./packages/alfian/indo-date-format" } ]
- Jalankan:
composer require alfian/indo-date-format:dev-main
- Tambahkan di
-
(Opsional) Jika Laravel tidak auto-discover, tambahkan di
config/app.php
:'providers' => [ // ... Alfian\IndoDateFormat\IndoDateServiceProvider::class, ],
📖 Penggunaan
1. Kelas Langsung
use Alfian\IndoDateFormat\IndoDate; echo IndoDate::format('01/01/2025'); // => 01 Januari 2025
2. Helper Function
Pastikan kamu menambahkan
src/helpers.php
dan mengautoload file tersebut dicomposer.json
:
// src/helpers.php if (! function_exists('indo_date')) { function indo_date(string $tanggal): ?string { return Alfian\IndoDateFormat\IndoDate::format($tanggal); } }
"autoload": { "psr-4": { "Alfian\\IndoDateFormat\\": "src/" }, "files": [ "src/helpers.php" ] }
composer dump-autoload
// Gunakan di mana saja echo indo_date('15/08/2025'); // => 15 Agustus 2025
⚙️ Konfigurasi (Opsional)
Kamu bisa extend kelas dasar untuk kebutuhan khusus:
namespace App\Services; use Alfian\IndoDateFormat\IndoDate as BaseIndoDate; class CustomDate extends BaseIndoDate { public static function formatWithDash(string $tanggal) { return parent::format($tanggal, '-'); } }
🤝 Contributing
- Fork repository ini
- Buat branch fitur:
git checkout -b feature/nama-fitur
- Commit perubahan:
git commit -m 'Menambahkan fitur baru'
- Push ke remote:
git push origin feature/nama-fitur
- Buka Pull Request
📄 Lisensi
MIT © [Alfian Maulana]