mediamaskio / mediamask-php
动态图片生成的Mediamask PHP API客户端
1.0.7
2022-09-02 12:16 UTC
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
README
此PHP客户端支持Mediamask POST API以生成动态图片。您可以在我们的文档中找到更多使用信息:https://docs.mediamask.io/docs/post-api。
安装与使用
需求
PHP 7.4及更高版本。
Composer
通过Composer安装
使用Composer将包安装到您的项目中
composer require mediamaskio/mediamask-php
### Manual Installation
Download the files and include `autoload.php`:
```php
<?php
require_once('/path/to/mediamask-php/vendor/autoload.php');
入门
请按照安装步骤进行操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Bearer authorization: bearerAuth $config = Mediamask\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Mediamask\Api\MediamaskApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); // \OpenAPI\Client\Model\NewImage | Provide the template and placeholders values that should be rendered in the image $new_image = { "template":"3fa85f64-5717-4562-b3fc-2c963f66afa6", "placeholders": [ { "name":"text placeholder name", "text":"an example text" }, { "name":"image placeholder name", "image":"https://example.com/example.jpg" } ] }; try { $result = $apiInstance->renderImage($new_image); print_r($result); } catch (Exception $e) { echo 'Exception when calling MediamaskApi->renderImage: ', $e->getMessage(), PHP_EOL; }
API端点
所有URI都是相对于https://mediamask.io/api/v1
模型
- DynamicLayer
- Error
- ImagePlaceholder
- NewImage
- NewImagePlaceholdersInner
- Template
- Templates200Response
- TextPlaceholder
- ValidationError
授权
bearerAuth
- 类型:Bearer认证
测试
要运行测试,使用
composer install vendor/bin/phpunit
作者
关于此包
此PHP包是由OpenAPI Generator项目自动生成的
- API版本:
1.0.4
- 构建包:
org.openapitools.codegen.languages.PhpClientCodegen