<?php $app->get('/user/show', function () use($app) { $oLaboratory = new models\User(); $users = $oLaboratory->getUsers(); echo json_encode($users); }); $app->post('/user/insert', function () use($app) { $user = $app->request()->post(); $oUser = new models\User(); echo $oUser->insertUser($user); });