PHP code example of bulbul5391 / english-to-bangla

1. Go to this page and download the library: Download bulbul5391/english-to-bangla library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bulbul5391 / english-to-bangla example snippets


use Bulbul5391\EnglishToBangla\EnToBn;
$convert = new EnToBn();

echo $convert->enToBn(1233.77, 'w');
Output : এক হাজার দুই শত তেত্রিশ দশমিক সাত সাত

echo $convert->enToBn('January');
Output : জানুয়ারি

echo $convert->enToBn('520', 'm');
Output : পাঁচ শত বিশ টাকা

    /*---Controller---*/
    
    use Bulbul5391\EnglishToBangla\EnToBn; 
    class ReportController extends Controller
    {
        public function index(){
            $data['Controller] = 'App\Http\Controllers\ReportController';
            return view('report',$data);
        }
        public static function enToBn($val, $for=null)
        {
           $convert = new EnToBn();
           return $convert->enToBn($val, $for); 
        }
    }
    
    /*---report.blade.php---*/
    {{ $Controller::enToBn(10510) }} //Output ১০৫১০
    {{ $Controller::enToBn(10510,'en') }} //Output 10510
    {{ $Controller::enToBn(10510, 'w') }} //দশ হাজার পাঁচ শত দশ

    php artisan vendor:publish --tag=EnToBnServiceProvider
    
    //Add this line in composer.json file
    "autoload-dev": {
        "files": [
            "app/Helpers/EnToBnHelper.php"
        ]
    }
    
    After Run : composer dump-autoload
    
    /*---Controller---*/
    class ReportController extends Controller
    {
        public function index(){
            return view('report');
        }
    }
    
    /*---report.blade.php---*/
    {{ enToBn(22222,'c')}}
    {{ enToBn(10510) }} //Output ১০৫১০
    {{ enToBn(10510,'en') }} //Output 10510
    {{ enToBn(10510, 'w') }} //দশ হাজার পাঁচ শত দশ