Category: Laravel, PHP, api

Laravel has been my go-to framework for all of my side projects thanks to its ease of use, but while integrating Cashier into Nana recently, I have seen that there is no easy way of testing the subscription creation flows when using Cashier. This might be good advice for certain cases, and would definitely provide a good way to test the flow end-to-end, and it has some advantages: but it also has its problems: Although some of these disadvantages can be solved by some clever tricks, it is still not the best approach.

For those of you who don’t know Prophecy, it is a dead-simple mocking library for PHP.

Let’s say that you have a simple pricing structure, and the user picked one of the options and checked out.

It is simply a POST request to the subscription creation endpoint, and it includes the request parameters we have defined at the beginning of our function.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners