1

First of all am so excited about this Swagger PHP, very expressive!

Is there any way we can give PHP variables within swagger annotations.

Below is my code:

define('API_PATH', '/api/demo');

/**
 * @SWG\Swagger(
 * basePath="{API_PATH}",
 * host="11.7.11.16:xxxx",
 * schemes={"http"},

Tried giving like $api_path inside annotation as well but its taking as string and API call is failing....

basePath="$api_path",

Any help will be appreciated

1 Answer 1

6

You could consider using the constant:

in constants.php

 define('API_PATH', ''/api/demo");

in api.php

/**
 * @SWG\Swagger(basePath=API_PATH, ...)
 */

Which can be loaded using the bootstrap option:

$ swagger --bootstrap constants.php api.php
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Bob will try it and let u know! :)
yes i tried that but didn't worked for my i have permission issues in my work station but i did another fix for that... anyway thanks for info!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.