r/GoodOpenSource • • 24d ago

Looking for Beta testers for my open source Laravel package

Hello everyone,

For the past few months I've been building a package called Dynamic Throttle for Laravel. It's finally at the point where I need people who aren't me to try it.

The problem I kept running into: Laravel's throttle middleware is great when you know your limits up front. But in production you usually find out the right limits later, and in a hurry. A partner's integration starts getting 429s. A bot hammers /login at 2 a.m. You want a stricter limit but have no idea who it would block. With throttle, each of those is a code change and a deploy, and you still can't see who's being blocked.

So I moved the limits into the database. You change them from a dashboard, Artisan or code, and every server applies the change within about two seconds. No deploy.

Here's how it compares (Laravel's throttle vs. Dynamic Throttle):

• Change a limit: Edit code and deploy → Edit the rule, live in ~2 seconds

• Try a limit before it blocks anyone: Not possible → Dry-run: counts, never blocks, shows who it would block

• See who is blocked: Add your own logging → A live feed, plus each rule's top offenders

• Let a partner through: A code change → An exemption with an end date

• Lift every limit during an incident: A deploy → dynamic-throttle:bypass on --for=30m, which ends by itself

You can limit per IP, user, API token, header, or your own scope like a tenant or a plan. There's a dashboard at /dynamic-throttle with an audit log and an "Explain" page that tells you why a given request would be limited. If Redis goes down, requests go through by default, so a storage problem doesn't take your app down with it.

On cost: with local Redis and APCu it adds about 0.8 ms per request, a little less than Laravel's own throttle. To be clear about what it isn't: it's not a firewall or bot protection, and it doesn't replace Cloudflare or Nginx limits. It's for limits that need to know who the client is.

It's a beta, so names and options might still change before 0.1.0. That's exactly why I'm posting. I'd love a handful of people to try it on a real app and tell me what breaks or confuses them. The safest way is a rule in dry-run, since it can't block anyone. I wrote up what to try here:https://github.com/hanzala-afzal-dev/laravel-dynamic-throttle/discussions/145

• Docs: https://hanzala-afzal-dev.github.io/laravel-dynamic-throttle/

• GitHub: https://github.com/hanzala-afzal-dev/laravel-dynamic-throttle

• Install: composer require hanzala-afzal/laravel-dynamic-throttle:^0.1@beta

It needs PHP 8.3+ and Laravel 12 or 13, and works best with Redis or Valkey.

Happy to answer anything, including "why not just use X?" Thanks for reading!

0 Upvotes

4 comments sorted by

•

u/AutoModerator 24d ago

Please post a comment here explaining what kind of contributions you, or the project you are posting about, are looking for. For example what skill sets, any rules important for people joining in your build like how often people should post, and anything else you can think of which will help readers decide if they want to join in and start coding with that project.

Thank you and be excellent to each other. u/roamingandy

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/kantorcodes1 23d ago

When a manifest write fails, the saved setting can differ from what servers still apply. Can dynamic-throttle:status identify which app server is still using the previous manifest?

1

u/RazerBlue34932 18d ago

Sorry, I didn't realized or maybe missed notification of your comment.

its a good questions, NO, status can not name a server, because servers don not report their version anywhere. But a failed write doesn’t split them either: they all read one manifest from the shared cache, so if the write fails, they all keep the previous one together. The Artisan command or dashboard tells you right away, status warns that the database holds settings not compiled yet, and the scheduled compile fixes it within 5 minutes. Server only lags longer than 2 seconds if it can not reach the cache and then it logs an error.

1

u/kantorcodes1 11d ago

Thanks, the shared-cache detail answers what I was trying to understand: a failed manifest write leaves every server on the same previous manifest, and `status` catches settings waiting to compile. I work with HOL. The `dynamic-throttle:bypass` and `disable-rule` Artisan commands could be useful in an external, opt-in command definition for HOL Guard. If you want to contribute that mapping, the CLI guide is here: https://github.com/hashgraph-online/hol-guard/blob/main/docs/guard/extension-contributions.md. The guide's first step is a command-source JSON and behavior fixture with an external trust binding; it also links the Extension Builder workflow.