PHP code example of vender-demo / first-project
1. Go to this page and download the library: Download vender-demo/first-project library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vender-demo / first-project example snippets
use SwaggerPetstoreOpenApi30Lib\Logging\LoggingConfigurationBuilder;
use SwaggerPetstoreOpenApi30Lib\Logging\RequestLoggingConfigurationBuilder;
use SwaggerPetstoreOpenApi30Lib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
use SwaggerPetstoreOpenApi30Lib\Environment;
use SwaggerPetstoreOpenApi30Lib\Authentication\PetstoreAuthCredentialsBuilder;
use SwaggerPetstoreOpenApi30Lib\Models\OauthScopePetstoreAuth;
use SwaggerPetstoreOpenApi30Lib\Authentication\ApiKeyCredentialsBuilder;
use SwaggerPetstoreOpenApi30Lib\SwaggerPetstoreOpenApi30ClientBuilder;
$client = SwaggerPetstoreOpenApi30ClientBuilder::init()
->petstoreAuthCredentials(
PetstoreAuthCredentialsBuilder::init(
'OAuthClientId',
'OAuthRedirectUri'
)
->oauthScopes(
[
OauthScopePetstoreAuth::WRITEPETS,
OauthScopePetstoreAuth::READPETS
]
)
)
->apiKeyCredentials(
ApiKeyCredentialsBuilder::init(
'api_key'
)
)
->environment(Environment::PRODUCTION)
->loggingConfiguration(
LoggingConfigurationBuilder::init()
->level(LogLevel::INFO)
->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
)
->build();