PHPackages                             bangladatetime/laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. bangladatetime/laravel

ActiveLibrary

bangladatetime/laravel
======================

A Laravel package to format DateTime to Bangla and support Bangla calendar.

1.0.2(7mo ago)15191↓100%5[1 PRs](https://github.com/BanglaDateTime/Laravel/pulls)MITPHPPHP &gt;=7.3CI passing

Since Sep 13Pushed 7mo agoCompare

[ Source](https://github.com/BanglaDateTime/Laravel)[ Packagist](https://packagist.org/packages/bangladatetime/laravel)[ RSS](/packages/bangladatetime-laravel/feed)WikiDiscussions 1.x Synced today

READMEChangelog (3)Dependencies (5)Versions (6)Used By (0)

BanglaDateTime
==============

[](#bangladatetime)

**BanglaDateTime** is a Laravel package that allows you to easily format and convert DateTime to the Bangla calendar and Bangla number formats. It supports both current time and custom dates, as well as timezones.

Features
--------

[](#features)

- Convert DateTime to Bangla format.
- Convert to the Bangla calendar (Bengali Era).
- Supports custom dates and timezones.
- Easy to use with a fluent API.
- Helper functions for easy access to common operations.

Installation
------------

[](#installation)

You can install the package via [Composer](https://getcomposer.org/):

```
composer require bangladatetime/laravel
```

Laravel Integration
-------------------

[](#laravel-integration)

To integrate **BanglaDateTime** with Laravel, follow these steps:

1. **Publish the Configuration File:**

    Run the following command to publish the package configuration file:

    ```
    php artisan vendor:publish --provider="BanglaDateTime\Laravel\BanglaDateTimeServiceProvider"
    ```

    This will create a configuration file at `config/bangladatetime.php`.
2. **Configuration:**

    Edit the `config/bangladatetime.php` file to set your desired date formats and timezone.
3. **Usage:**

    The package integrates with Laravel's `Carbon` class, allowing you to use custom methods to format dates in Bangla format and Bangla calendar directly.

### Using with Eloquent Models

[](#using-with-eloquent-models)

If you have a model with a `datetime` cast, you can easily format the datetime attributes using the BanglaDateTime methods. For example:

```
use App\Models\User;

// Retrieve a user and format the created_at attribute in Bangla format
$user = User::find(1);
echo $user->created_at->formatBangla('l jS F Y h:i:s');

// Format the created_at attribute in Bangla calendar format
echo $user->created_at->toBangla('l jS F Y h:i:s');
```

**Output:**

```
Created at with Bangla format: বৃহস্পতিবার ১২ই সেপ্টেম্বর ২০২৪ ০৩:৩৭:০৩
Created at converted to Bangla: বৃহস্পতিবার ২৮শে ভাদ্র ১৪৩১ ০৩:৩৭:০৩

```

### Basic Example

[](#basic-example)

```
use Illuminate\Support\Carbon;

// Get current date and time in Bangla format
echo Carbon::now()->formatBangla('l jS F Y h:i:s');

// Get current date and time in Bangla calendar format
echo Carbon::now()->toBangla('l jS F Y h:i:s');
```

**Output:**

```
Current time with Bangla format: বৃহস্পতিবার ১২ই সেপ্টেম্বর ২০২৪ ০৩:৩৭:০৩
Current time converted to Bangla: বৃহস্পতিবার ২৮শে ভাদ্র ১৪৩১ ০৩:৩৭:০৩

```

### Setting a Custom Date

[](#setting-a-custom-date)

```
use Illuminate\Support\Carbon;

// Set a custom date ('2023-04-13') in Bangla format
echo Carbon::create('2023-04-13')->formatBangla('l jS F Y h:i:s');

// Set a custom date ('2023-04-13') in Bangla calendar format
echo Carbon::create('2023-04-13')->toBangla('l jS F Y h:i:s');
```

**Output:**

```
Set Time with Bangla format: বৃহস্পতিবার ১৩ই এপ্রিল ২০২৩ ১২:০০:০০
Set Time & converted to Bangla: বৃহস্পতিবার ৩০শে চৈত্র ১৪২৯ ১২:০০:০০

```

### Working with Timezones

[](#working-with-timezones)

```
use Illuminate\Support\Carbon;

// Set current time with a specific timezone ('Asia/Dhaka') in Bangla format
echo Carbon::now('Asia/Dhaka')->formatBangla('l jS F Y h:i:s');

// Set current time with a specific timezone ('Asia/Dhaka') in Bangla calendar format
echo Carbon::now('Asia/Dhaka')->toBangla('l jS F Y h:i:s');
```

**Output:**

```
Set Time & Time Zone with Bangla format: বৃহস্পতিবার ১২ই সেপ্টেম্বর ২০২৪ ০৯:৩৭:০৩
Set Time & Time Zone & converted to Bangla: বৃহস্পতিবার ২৮শে ভাদ্র ১৪৩১ ০৯:৩৭:০৩

```

### Custom Format and Timezone

[](#custom-format-and-timezone)

You can specify a custom format and timezone when calling `formatBangla` and `toBangla` methods:

```
use Illuminate\Support\Carbon;

// Get current date and time in Bangla format with a custom format and timezone
echo Carbon::now()->formatBangla('d/m/Y H:i:s', 'Asia/Dhaka');

// Get current date and time in Bangla calendar format with a custom format and timezone
echo Carbon::now()->toBangla('d/m/Y H:i:s', 'Asia/Dhaka');
```

**Output:**

```
Custom Time with Bangla format: ১২/০৯/২০২৪ ১৫:৩৭:০৩
Custom Time & converted to Bangla: ২৮/ভাদ্র/১৪৩১ ১৫:৩৭:০৩

```

API
---

[](#api)

### `BanglaDateTime::create($time = 'now', $timezone = 'UTC')`

[](#bangladatetimecreatetime--now-timezone--utc)

Creates a new `BanglaDateTime` instance.

- **`$time`**: The date and time to use (optional, defaults to `'now'`).
- **`$timezone`**: The timezone to use (optional, defaults to `'UTC'`).

### `format($format)`

[](#formatformat)

Formats the date and time using a specified format, with the output in the Bangla locale.

- **`$format`**: The format string (same as PHP's `DateTime::format`).

### `toBangla($format)`

[](#tobanglaformat)

Converts and formats the date and time into the Bangla calendar and Bangla numbers.

- **`$format`**: The format string (same as PHP's `DateTime::format`).

Helper Functions
----------------

[](#helper-functions)

**BanglaDateTime** provides the following global helper functions for easy access:

- **`bangla_date_time($time = 'now', $timezone = 'UTC')`**: Creates a new `BanglaDateTime` instance.

    ```
    $date = bangla_date_time('2023-04-13', 'Asia/Dhaka');
    ```
- **`format_bangla_date($format, $time = 'now', $timezone = 'UTC')`**: Formats a date/time in Bangla format.

    ```
    echo format_bangla_date('l jS F Y h:i:s');
    ```
- **`convert_to_bangla_calendar($format, $time = 'now', $timezone = 'UTC')`**: Converts a date/time to Bangla calendar format.

    ```
    echo convert_to_bangla_calendar('l jS F Y h:i:s');
    ```

Contributing
------------

[](#contributing)

Feel free to contribute by submitting a pull request or opening an issue. Your contributions are highly appreciated!

License
-------

[](#license)

This library is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

35

—

LowBetter than 81% of packages

Maintenance64

Regular maintenance activity

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 88.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~108 days

Total

4

Last Release

233d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a6975c50488b3eeb7cb613bf0b280342ce3912dc4ffaa1aa14b75add8fe070a?d=identicon)[rtraselbd](/maintainers/rtraselbd)

---

Top Contributors

[![rtraselbd](https://avatars.githubusercontent.com/u/31556372?v=4)](https://github.com/rtraselbd "rtraselbd (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

laraveldatetimeBangladate-conversionbangladeshBangla Calendar

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/bangladatetime-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/bangladatetime-laravel/health.svg)](https://phpackages.com/packages/bangladatetime-laravel)
```

###  Alternatives

[hekmatinasser/verta

This Package helps developers to work with Jalali Datetime class for Laravel Framework PHP

657526.5k25](/packages/hekmatinasser-verta)[rakibhstu/number-to-bangla

A Laravel package for converting English numbers into Bangla digits, Bangla words, Bangla month names, and Bangla money format with an easy-to-use API.

8310.0k](/packages/rakibhstu-number-to-bangla)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
