Is it possible to have a dev version path for the Element API plugin so we can keep live and dev API separated?
Craft config files usually allow to return environment-specific arrays. So you could just configure different endpoints like so:
return [
'*' => [],
'.com' => [
'endpoints' => [
'api/example<ext:(.json)?>' => function() {
// example API config for live environment
},
],
],
'.dev' => [
'endpoints' => [
'api/example<ext:(.json)?>' => function() {
// example API config for dev environment
},
],
],
];
Doh so the answer is PHP constants:
define('CRAFT_CONFIG_PATH', '../../craftdev/config/');
useful to know.
-
1That'll change the path for all your config files (including
db.php
,general.php
and Redactor configs), though. – Mats Mikkel Rummelhoff Dec 15 '16 at 9:17