Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

in4s's avatar
Level 10

How to make a POST request inside a Mink session?

I tried to use $this->getSession()->getDriver()->request(...), but it can't find the request method.

0 likes
4 replies
in4s's avatar
Level 10

I saw that solution but is there any way to make it with the POST request? In my opinion, a single login POST request will work much faster than that.

in4s's avatar
Level 10

There is also another type of login solution (without post request): https://stackoverflow.com/a/27354060/12580089

For example, it is possible to save a session id cookie from the first authorization and use it on other feature scenarios. Of course, there are some design minuses, and it, probably won't work this way with laravel. But for some vanilla PHP projects for testing purposes, it's possible to use this approach. It can speeds up tests execution for 1 second for each scenario with the admin area. If it is 300 tests, it saves 5 minutes of each run.

Please or to participate in this conversation.