Note that there are some explanatory texts on larger screens.

plurals
  1. POSmart routing with PHPDoc not working with Restler v3
    text
    copied!<p>I am having a bit of an issue implementing the smart url routes in Restler PHP REST Framework v3. Basically it appears as if Restler is ignoring my comments. I have attached my index.php and tests.inc.php files here. What is happening, is even with the PHPDoc comments, it seems as though restler is ignoring them and only responding to the default "tests" call and not "some/new/route" as I would have expected based on the routes example provided with the framework.</p> <p><strong>index.php</strong></p> <pre><code>&lt;?php $root_dir = $_SERVER['DOCUMENT_ROOT']; $base_dir = getcwd(); $include = "{$base_dir}/include"; require_once("{$include}/config.inc.php"); require_once("{$include}/library-general.inc.php"); //include restler library $restler_dir = "{$root_dir}/restler/{$settings['restler_version_string']}"; require_once("{$restler_dir}/restler.php"); //restler configuration use Luracast\Restler\Restler; use Luracast\Restler\Defaults; //include database connector class require_once("{$include}/db_connector_mysql.inc.php"); //include api handler classes require_once('test.inc.php'); require_once('accounts.inc.php'); //instantiate our restler object; call with argument "true" to run in production mode $r = new Restler(); //bind api classes $r-&gt;addAPIClass('Tests'); $r-&gt;addAPIClass('Accounts'); //set supported formats: JSON ONLY! $r-&gt;setSupportedFormats('JsonFormat'); //handle the request $r-&gt;handle(); </code></pre> <p><strong>test.inc.php</strong></p> <pre><code>&lt;?php class Tests { private $dbc; private $function_log_tag; public function __construct () { $this-&gt;dbc = DB_Connector_MySQL::getConnection(); $this-&gt;response = new stdClass(); } /* ** @url GET /some/new/route */ public function get () { //load required global variables global $settings; //set logging tag $this-&gt;function_log_tag = '[' . __CLASS__ . '::' . __FUNCTION__ . '][v' . $settings['version'] . ']'; return $this-&gt;function_log_tag; } } </code></pre> <p>I have been trying a number of different things to attempt to find the root problem. It is worth noting that I haven't seemed to be able to locate the "routes.php" file so I am possibly thinking it might be a write permission issue on the server. Anyhow, any help would be greatly appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload