github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/php/README.mustache (about) 1 # {{packageName}} 2 3 Phrase Strings is a translation management platform for software projects. You can collaborate on language file translation with your team or order translations through our platform. The API allows you to import locale files, download locale files, tag keys or interact in other ways with the localization data stored in Phrase Strings for your account. 4 5 This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: 6 7 - API version: {{appVersion}} 8 {{#artifactVersion}} 9 - Package version: {{artifactVersion}} 10 {{/artifactVersion}} 11 {{^hideGenerationTimestamp}} 12 - Build date: {{generatedDate}} 13 {{/hideGenerationTimestamp}} 14 - Build package: {{generatorClass}} 15 {{#infoUrl}} 16 For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) 17 {{/infoUrl}} 18 19 ## Requirements 20 21 PHP 5.5 and later 22 23 ## Installation & Usage 24 25 ### Composer 26 27 To install the bindings via [Composer](http://getcomposer.org/) from [Packagist](https://packagist.org/), run in console: 28 29 `composer require phrase/phrase-php` 30 31 32 If you prefer to install the bindings via [Composer](http://getcomposer.org/) from Github repository, add the following to `composer.json`: 33 34 ```json 35 { 36 "repositories": [ 37 { 38 "type": "vcs", 39 "url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git" 40 } 41 ], 42 "require": { 43 "{{gitUserId}}/{{gitRepoId}}": "*@dev" 44 } 45 } 46 ``` 47 48 Then run `composer install` 49 50 ### Manual Installation 51 52 Download the files and include `autoload.php`: 53 54 ```php 55 require_once('/path/to/{{packageName}}/vendor/autoload.php'); 56 ``` 57 58 ## Tests 59 60 To run the unit tests: 61 62 ```bash 63 composer install 64 ./vendor/bin/phpunit 65 ``` 66 67 ## Getting Started 68 69 Please follow the [installation procedure](#installation--usage) and then run the following: 70 71 ```php 72 <?php 73 require_once(__DIR__ . '/vendor/autoload.php'); 74 75 {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} 76 {{> php_doc_auth_partial}} 77 $apiInstance = new {{invokerPackage}}\Api\{{classname}}( 78 // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. 79 // This is optional, `GuzzleHttp\Client` will be used as default. 80 new GuzzleHttp\Client(){{#hasAuthMethods}}, 81 $config{{/hasAuthMethods}} 82 ); 83 {{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}} 84 {{/allParams}} 85 86 try { 87 {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} 88 print_r($result);{{/returnType}} 89 } catch (Exception $e) { 90 echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; 91 } 92 {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} 93 ?> 94 ``` 95 96 ## Datacenters 97 98 The API is only accessible via HTTPS and the current version is <code>v2</code>, which results in a base URL like: <code>{{{basePath}}}</code> depending on the datacenter. 99 100 ### EU Datacenter 101 ``` 102 {{{basePath}}} 103 ``` 104 105 This is the default datacenter. 106 107 ### US Datacenter 108 ``` 109 https://api.us.app.phrase.com/v2/ 110 ``` 111 112 ### Specifying US Datacenter 113 You can use the US datacenter by setting the following: 114 ``` 115 $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setHost('https://api.us.app.phrase.com/v2/'); 116 ``` 117 118 ## Documentation For Authorization 119 120 {{^authMethods}} 121 All endpoints do not require authorization. 122 {{/authMethods}} 123 {{#authMethods}} 124 {{#last}} Authentication schemes defined for the API:{{/last}} 125 126 ## {{{name}}} 127 128 {{#isApiKey}} 129 130 - **Type**: API key 131 - **API key parameter name**: {{{keyParamName}}} 132 - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} 133 134 ```php 135 $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); 136 $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'token'); 137 ``` 138 139 {{/isApiKey}} 140 {{#isBasic}} 141 {{#isBasicBasic}} 142 143 - **Type**: HTTP basic authentication 144 145 ```php 146 $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration() 147 ->setUsername('YOUR_USERNAME') 148 ->setPassword('YOUR_PASSWORD'); 149 ``` 150 {{/isBasicBasic}} 151 {{#isBasicBearer}} 152 153 - **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} 154 155 ```php 156 // Configure Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authorization: {{{name}}} 157 $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); 158 ``` 159 {{/isBasicBearer}} 160 {{/isBasic}} 161 {{#isOAuth}} 162 163 - **Type**: OAuth 164 - **Flow**: {{{flow}}} 165 - **Authorization URL**: {{{authorizationUrl}}} 166 - **Scopes**: {{^scopes}}N/A{{/scopes}} 167 {{#scopes}} 168 - **{{{scope}}}**: {{{description}}} 169 {{/scopes}} 170 {{/isOAuth}} 171 172 {{/authMethods}} 173 174 ## Documentation for API Endpoints 175 176 All URIs are relative to *{{basePath}}* 177 178 Class | Method | HTTP request | Description 179 ------------ | ------------- | ------------- | ------------- 180 {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} 181 {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} 182 183 ## Documentation For Models 184 185 {{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md) 186 {{/model}}{{/models}} 187 188 ## Author 189 190 {{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} 191 {{/-last}}{{/apis}}{{/apiInfo}} 192 193 ## Get help / support 194 195 Please contact [support@phrase.com](mailto:support@phrase.com?subject=[GitHub]%20phrase-php) and we can take more direct action toward finding a solution.