truschery started a new conversation+100 XP
19h ago
Hi everyone,
I’m developing a Laravel package designed to handle idempotency across an entire application.
Why another package?
While looking for existing solutions, I noticed most packages only provide HTTP Middleware. However, in real-world apps, we often need idempotency for Queues or specific code blocks.
My package solves this by offering three layers of protection:
- HTTP Middleware
- Job Middleware
- Fluent Helper
Tech Stack & Features
PHP: ^8.2 Laravel: ^10.0 Storage: Drivers for both Cache and Database
Code Architecture
Here is how the end-user interacts with the package:
// 1. HTTP Route — attach middleware
Route::post('/checkout', CheckoutController::class)
->middleware('idempotent');
// 2. Job — prevent duplicate execution
public function middleware(): array
{
return [new EnsureIdempotent];
}
// 3. Facade — once for any callback
Once::do('send-welcome', fn() =>
Mail::to($user)->send(new WelcomeMail)
);
What I need review on
Security: Do you see any vector for payload tampering or cache-poisoning based on how keys are managed? Code Quality: Where could I refactor to make it more compliant with Laravel's core philosophy?
Documentation
You can find the full source code, architecture details, and installation guide in the repository: github.com/truschery/idem
Contributing
The package is open-source, and I would love to make it a community-driven solution! If you see something that can be improved, feel free to:
- Open an Issue with suggestions.
- Submit a Pull Request
Thanks in advance for your time, critique, and help!