Laravel Money Format

Need to convert a float or string into a currency format in Laravel?

Here are two quick methods. Use PHP’s number_format() in your blade template.

{{ number_format($travelcosts, 2, ',', '.') }}

You can also add the following to your AppServiceProvider’s boot method.

    public function boot()
        // Blade money directive
        Blade::directive('money', function ($amount) {
            return "<?php echo '$' . number_format($amount, 2); ?>";

// your blade file

Good luck!

1 thought on “Laravel Money Format”

Leave a Comment