Not too long ago, I found myself repeating the same thing over and over again while building Filament projects —
adding money or price input fields, formatting them correctly, making sure they’re stored cleanly in the database.
At some point, I realized: why not turn it into a reusable component?
That’s how Filament Money was born — my first open-source plugin for FilamentPHP.
In this post, I’ll take you behind the scenes: how I built it, what challenges I faced, and what I learned from the process.
💡 The Problem That Started It All
When working with Filament forms, handling money inputs always felt repetitive.
You’d use a text or number input, then manually format, validate, and parse the value.
Something like this:
TextInput::make('price')
->numeric()
->prefix('Rp')
->mask(fn (Mask $mask) => $mask->numeric()->decimalPlaces(2)->thousandsSeparator('.'))
Looks fine… until you need to repeat that logic across multiple forms 😅 That’s when I thought, “There has to be a better way.”
⚙️ Planning the Plugin
I didn’t want to just wrap an input component and call it a day — the goal was to create something simple, flexible, and configurable.
So I listed a few core features:
- ✅ Default currency (configurable)
- ✅ Custom decimal places
- ✅ Easy to use — just
Money::make('price') - ✅ Compatible with Filament forms
The idea was to make it feel native — like it’s part of Filament itself.
🧱 Building the Component
Filament makes it surprisingly straightforward to extend its components. I started by generating the structure using:
php artisan make:filament-component Money
Then I customized it to handle numeric formatting and default settings. The core of the logic lives in:
use Filament\Forms\Components\TextInput;
class Money extends TextInput
{
protected function setUp(): void
{
parent::setUp();
$this->numeric()
->suffix(config('filament-money.currency', 'IDR'))
->rule('numeric')
->mask(fn ($mask) => $mask
->numeric()
->decimalPlaces(config('filament-money.decimal_places', 2))
->thousandsSeparator('.'));
}
}
Once that worked, I published the config file to make it customizable.
🧩 Publishing and Testing
The first time I published it to Packagist, it felt surreal. Just running:
composer require codewithdiki/filament-money
and seeing my own package install… that’s a moment I won’t forget. It’s simple, but it represents something bigger — shipping your own tools into the world.
I also set up basic GitHub Actions for:
- ✅ Running tests
- ✅ Checking code style (using Laravel Pint)
- ✅ Auto-publishing version badges
This helped keep the repository clean and ready for contributions.
🚀 What I Learned
Here are a few things I took away from building my first Filament plugin:
-
Start small. You don’t need to create something huge. Just solve one real problem cleanly.
-
Packaging teaches structure. You’ll learn a lot about Composer, autoloading, versioning, and testing.
-
Documentation matters. Writing a good README is half the job — it’s what helps others actually use your work.
-
Open source is rewarding. Seeing people download and use your package, even just a few, is a huge motivator.
🧭 What’s Next?
I plan to improve Filament Money with a few upcoming features:
- 💱 Dynamic currency selector
- 🧮 Built-in conversion formatting
- 🎨 Customizable UI styles for different currencies
It’s still early, but I’m proud of how far it’s come.
If you want to check it out or contribute, it’s open source on GitHub: 👉 github.com/codewithdiki/filament-money
✍️ Final Thoughts
Building your own plugin isn’t just about code — it’s about growth. You learn how to think like a package maintainer, design APIs, write docs, and support other developers.
If you’ve ever thought about building your own Filament or Laravel package, just start. Pick a small problem, and create your own solution — you’ll learn so much along the way.
Who knows? Your “small idea” might end up helping hundreds of other developers, too.
Thanks for reading — and if you’d like to see more of my work, you can visit dikiakbarasyidiq.dev.