php - Restler won't call any API methods -
restler refusing instantiate of api classes. it's saying fails on route, doesn't bother provide other useful information. installed restler via composer via "restler/framework" : "3.0.0-rc6"
, created index.php looks this:
<?php require __dir__.'/../vendor/autoload.php'; use luracast\restler\restler; $r = new restler(); $r->addapiclass('explorer'); $r->addapiclass('play'); $r->handle();
in exact same directory index.php i've created file called play.php looks so:
<?php public class play { public function __construct() { error_log("i called constructor!\n", 3, '/tmp/scott'); } public function index() { error_log("i called index\n", 3, '/tmp/scott'); }
when call http://.../api/play
never see /tmp/scott file created, , generic failure response restler:
{ "error": { "code": 404, "message": "not found" }, "debug": { "source": "routes.php:438 @ route stage", "stages": { "success": [ "get" ], "failure": [ "route", "negotiate", "message" ] } } }
as luracast noted in comments, had edit composer.json add stanza:
"autoload": { "psr-0": { "": "api" } }
and run composer dump-autoload
Comments
Post a Comment