The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Class not instantiating in SLIM restful API

Samuel James's Avatar

Samuel James

12 Nov, 2015 06:10 PM

I want to use this medium to thank you for the job well done by creating this simple and easy to use framework. Thumb up.
My question is. I have an already built application. I used MVC method to build it. Now i want to create a public api for this application. All ajax calls will be going through this API. I have been able to installed slim and it works but my problem lies in using some of my existing classes by calling them in my SLIM index file (though i call my own api.php) to manipulate data.
The route keep returning null. Nothing was been processed!.
e,g
$app->post('/unlock', function() use ($app,$validator,$security,$session){
    $param =$app->request->post();
    $param=$validator->sanitize($param);
    if($security->unLockThisApp($param['password'])){
        echo json_encode(array('response'=>1));
    } else{
       echo json_encode(array("response"=>0,'msg'=>'Invalid Password'));
    }
});
The code"($security->unLockThisApp($param['password']") would not work. Security class extends Authentication class. Am just confused

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • Capture.PNG 39 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac