Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Bn Php Laravel Package

zdenekdrahos/bn-php

PHP library for working with Bangla/Bengali numbers and formatting. Convert between Bengali and Latin numerals, handle digit transformations, and support localization-friendly numeric output for apps needing Bangla numeral representation.

View on GitHub
Deep Wiki
Context7

Big Number data type for PHP which can be used as replacement of inaccurate float Use BC Math

Frequently asked questions about Bn Php
How do I install **zdenekdrahos/bn-php** in a Laravel project?
Run `composer require zdenekdrahos/bn-php` in your project root. The package is dependency-free, so no additional setup is needed beyond autoloading. Laravel’s Composer autoloader will handle the rest automatically.
Does this package support Laravel’s Eloquent models for BN validation?
Yes, you can use Laravel’s model casting or accessors to validate and format BN values. For example, cast a field as a string and validate it with the package’s `validate()` method in a model’s `boot()` or `getAttribute()` methods.
What Laravel versions does **bn-php** officially support?
The package is designed for Laravel 8+ due to its reliance on modern PHP features like traits and Composer autoloading. Test thoroughly if using Laravel 7 or earlier, as some functionality may require adjustments.
Can I use this for **Bengali numeral conversion** (e.g., ১২৩ → 123) in Laravel?
No, this package focuses on **business number validation/parsing**, not Bengali numeral conversion. For Bengali numerals, consider packages like `shahriarNafein/arabic-to-english-numbers` or `bengali-numerals` instead.
How do I handle BN values in Laravel database migrations?
Store BN values as strings in text/varchar columns to avoid precision loss. Use Laravel’s `attribute casting` to convert between strings and BN objects in models. For example, cast a `price` field as `string` and validate it with the package.
Will this package work with **Laravel’s query builder** for BN comparisons?
No, the package doesn’t integrate directly with Laravel’s query builder. You’ll need to manually validate BN values in application logic before passing them to queries or use raw SQL with string comparisons.
Are there any **performance concerns** when using BN validation in bulk operations?
The package is lightweight, but if validating thousands of BN values, consider batching operations or caching validated results. Avoid real-time validation in loops where possible to minimize overhead.
How do I **format BN values** consistently in API responses or Blade templates?
Use the package’s `format()` method to standardize BN output. For APIs, return formatted strings (e.g., `response()->json(['bn' => $bn->format()])`). In Blade, use `@php echo $bn->format() @endphp` or a custom helper.
What happens if I pass an **invalid BN** (e.g., letters, symbols) to the validator?
The `validate()` method will throw an exception (e.g., `InvalidBusinessNumberException`). Catch it in your application logic and handle errors gracefully, such as returning a 422 response in Laravel APIs.
Is there a **maintenance risk** with this package, given its low activity?
Yes, the package appears unmaintained. Fork it on GitLab or maintain a local copy if it’s critical to your project. Alternatively, evaluate alternatives like `moneyphp/money` for financial BN handling or build a custom solution.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core