Alright, this one is a bit funky. But it is because of FlightPHP. Normally, the answer provided by Mike Brant would be 100% correct! However, FlightPHP reads that input before I can, and according to the PHP documentation it can only be read once.
So, where does FlightPHP put it? Ha, now that's an odd one. They put it in a property named body
, so I had to do this to grab those JSON values:
$vars = json_decode(Flight::request()->body, true);
The Flight::request()->body
returns the JSON string. But then that needs decoded and turned into an associative array, so that's why I'm passing the true
as the second parameter.