lmsqueezy / laravel

A package to easily integrate your Laravel application with Lemon Squeezy.
https://lemonsqueezy.com
MIT License
521 stars 51 forks source link

Improve listen command #69

Open driesvints opened 11 months ago

driesvints commented 11 months ago

It would be cool if we could somehow get the event name and ID in the output of the listen command in similar fashion as the stripe listen command. I'm not sure if that's possible though because Expose controls the output here. cc @mpociot @DanielHudson

Screenshot 2023-12-13 at 09 33 54
DanielHudson commented 11 months ago

Yes, currently the output from both expose and ngrok are not looking great.

The only way I can think to do this for both services is to log incoming webhooks via WebhookHandled, and then have the command do some kinda of tail -f equivalent in the "process" loop.

Downside is you'd probably need to always save the webhook logs either when not in production, or when LOG_LEVEL=debug, unless a specific config is added.

Happy to have a look at this if it sounds useful.

mpociot commented 11 months ago

So the way I want to approach this with Expose is to have some kind of payload specific output.

We would have an array of "drivers" that detect which URL the request is coming from. If it's from a URL that is registered, we would parse the payload and the driver can then take care of rendering the CLI output. This way this could be added to Expose for all sorts of providers.

driesvints commented 11 months ago

@mpociot that would be fantastic really.

DanielHudson commented 8 months ago

Happy to take a look at the alternative solution when I get a sec if it helps, my suggestion should also work for ngrok too...

We could switch to @mpociot suggestion later if the feature becomes available. (Maybe it already is?)

heyjorgedev commented 8 months ago

@DanielHudson can we also create a file somewhere when the listen command gets executed, tail it like you suggested and on the WebhookHandled check for the existence of such file and write to it? after the command exits delete the file like you delete the webhooks