Search code examples
phpslim-3

Slim 3 access response/request object from another class


I have a Utils class, I need to use $response/$request from Slim 3 to use some useful methods (ex: $request->getUri()->getPath()), how can I access to $request or $response like that:

class AppCore
{

    public static function AllowRoutePass($request, $response)
    {
        $reqMethod =$request->getUri()->getPath();
        if (in_array($reqMethod, AppConfig::IGNORE_ROUTES))
            return true;
        return false;
    }

}

Thank everyone!


Solution

  • OK, i also create an question in Githup Slim repository here: Slim 3 access response/request object from another class.
    Currently there is no way to implement the util class I was described as above. Check out the link to see more informations. In my case, i must change my logics and implement my util class in another way.