Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spacetab-io/gotenberg-sdk-php
A simple PHP async client for interacting with a Gotenberg API. Based on amphp.
https://github.com/spacetab-io/gotenberg-sdk-php
gotenberg php sdk sdk-php
Last synced: about 1 month ago
JSON representation
A simple PHP async client for interacting with a Gotenberg API. Based on amphp.
- Host: GitHub
- URL: https://github.com/spacetab-io/gotenberg-sdk-php
- Owner: spacetab-io
- License: mit
- Created: 2020-06-24T12:51:08.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-24T13:38:20.000Z (over 4 years ago)
- Last Synced: 2024-08-03T22:14:47.765Z (4 months ago)
- Topics: gotenberg, php, sdk, sdk-php
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gotenberg - PHP - spacetab-io/gotenbserg-sdk-php - Gotenberg **6.x** ⚠️ (Clients)
README
Asynchronous PHP Gotenberg SDK
------------------------------A simple PHP async client for interacting with a Gotenberg API. Based on [Amphp](https://amphp.org).
Util `1.0.0` release library is unstable. Not ready for production use.
## Install
```bash
composer require spacetab-io/gotenberg-sdk
```## Usage example
### Simple methods which returns a promise
```php
use Amp\Loop;
use Spacetab\Logger\Logger;
use Psr\Log\LogLevel;
use Spacetab\Sdk\Gotenberg;
use Spacetab\Sdk\Gotenberg\Request;require __DIR__ . '/vendor/autoload.php';
Loop::run(function () {
$logger = Logger::default('Gotenberg', LogLevel::DEBUG);
$gotenberg = Gotenberg\Client::new('http://0.0.0.0:3000');
$gotenberg->setLogger($logger);$option = new Request\Html();
$option->setLandscape(true);
$option->setMarginBottom(0.1);
$option->setMarginLeft(0.1);
$option->setMarginRight(0.1);
$option->setMarginTop(0.1);
$option->setScale(0.70);/** @var \Spacetab\Sdk\Gotenberg\Output $output */
$output = yield $gotenberg->html()->fromString('hi
', $option);
yield $output->asFile(__DIR__ . '/index.pdf');
});
```## Supported methods
* Converts from HTML to PDF
## License
The MIT License
Copyright © 2020 spacetab.io, Inc. https://spacetab.io
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.