I'm using Symfony4 as project framework and I installed Restler Api.
I have a problem that when I call i.e api/explorer/functionName?abc=xxx
it says the argument abc is required. ???
I have chaeck my request url and I found that the GET parameter is rendered as \abc? Why?
Is there something to do with app.php or explorer/index.php.
//app.php
use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../../vendor/autoload.php';
if (PHP_VERSION_ID < 70000) {
include_once __DIR__.'/../../var/bootstrap.php.cache';
}
// The check is to ensure we don't use .env in production
if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../../.env');
}
$kernel = new Kernel('prod', false);
if (PHP_VERSION_ID < 70000) {
//$kernel->loadClassCache();
}
// fix undefined index notice's in restler lib
error_reporting(E_ERROR | E_WARNING | E_PARSE);
Luracast\Restler\Resources::$hideProtected = false;
Luracast\Restler\Resources::$placeFormatExtensionBeforeDynamicParts = false;
Luracast\Restler\Defaults::$crossOriginResourceSharing = true;
//let restler handle the api request
$API_PREFIX = "secret";
$r = new \Luracast\Restler\Restler(false, true);
$r->addAPIClass('Luracast\\Restler\\Resources'); //this creates resources.json at API Root
$r->addAPIClass('Luracast\\Restler\\Explorer\\v1\\Explorer'); //this creates resources.json at API Root
$r->setSupportedFormats('JsonFormat', 'XmlFormat', 'CsvFormat');
$r->addAPIClass('App\Api\SecretApi', $API_PREFIX);
$secretApi = Luracast\Restler\Scope::get('App\Api\MyApi');
$kernel = new Kernel('dev', true);
if (PHP_VERSION_ID < 70000) {
//$kernel->loadClassCache();
}
$secretApi->kernel = $kernel;
$kernel->boot();
//RateLimit::setLimit('hour', 5000, 5010);
//$r->addFilterClass('RateLimit');
$r->handle();
Dears,
I'm using Symfony4 as project framework and I installed Restler Api.
I have a problem that when I call i.e api/explorer/functionName?abc=xxx
it says the argument
abc
is required. ???I have chaeck my request url and I found that the GET parameter is rendered as
\abc
? Why?Is there something to do with app.php or explorer/index.php.