{"id":13705221,"url":"https://github.com/thecodingmachine/gotenberg-php-client","last_synced_at":"2025-05-05T16:31:40.630Z","repository":{"id":45814680,"uuid":"129900335","full_name":"thecodingmachine/gotenberg-php-client","owner":"thecodingmachine","description":"PHP client for the Gotenberg API","archived":true,"fork":false,"pushed_at":"2023-05-29T07:45:51.000Z","size":414,"stargazers_count":103,"open_issues_count":8,"forks_count":21,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-10-03T02:22:17.757Z","etag":null,"topics":["api","excel","gotenberg","html","markdown","pdf","pdf-converter","php","powerpoint","word"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodingmachine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-04-17T12:21:46.000Z","updated_at":"2024-04-14T07:45:37.000Z","dependencies_parsed_at":"2024-04-12T03:03:11.521Z","dependency_job_id":null,"html_url":"https://github.com/thecodingmachine/gotenberg-php-client","commit_stats":{"total_commits":47,"total_committers":8,"mean_commits":5.875,"dds":"0.25531914893617025","last_synced_commit":"eb67656824ba49221f0541603a605fb2ebc38487"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fgotenberg-php-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fgotenberg-php-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fgotenberg-php-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fgotenberg-php-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodingmachine","download_url":"https://codeload.github.com/thecodingmachine/gotenberg-php-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223912841,"owners_count":17224206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","excel","gotenberg","html","markdown","pdf","pdf-converter","php","powerpoint","word"],"created_at":"2024-08-02T22:00:35.645Z","updated_at":"2024-11-13T13:30:16.494Z","avatar_url":"https://github.com/thecodingmachine.png","language":"PHP","readme":"⚠️ For **Gotenberg 7.x**, use [gotenberg-/gotenberg-php](https://github.com/gotenberg/gotenberg-php) instead.\n\n_This library is unmaintained and will not receive updates. Consider migrating to *Gotenberg 7.x* and the according new library instead._\n\n# Gotenberg PHP client\n\nA simple PHP client for interacting with a Gotenberg API.\n\n## Install\n\nUnless your project already have a PSR7 `HttpClient`, install `php-http/guzzle6-adapter`:\n\n```bash\n$ composer require php-http/guzzle6-adapter\n```\n\nThen the PHP client:\n\n```bash\n$ composer require thecodingmachine/gotenberg-php-client\n```\n\n## Usage\n\n```php\nuse TheCodingMachine\\Gotenberg\\Client;\nuse TheCodingMachine\\Gotenberg\\ClientException;\nuse TheCodingMachine\\Gotenberg\\DocumentFactory;\nuse TheCodingMachine\\Gotenberg\\HTMLRequest;\nuse TheCodingMachine\\Gotenberg\\Request;\nuse TheCodingMachine\\Gotenberg\\RequestException;\nuse GuzzleHttp\\Psr7\\LazyOpenStream;\n\n# create the client.\n$client = new Client('http://localhost:3000', new \\Http\\Adapter\\Guzzle6\\Client());\n# ... or the following if you want the client to discover automatically an installed implementation of the PSR7 `HttpClient`.\n$client = new Client('http://localhost:3000');\n\n# prepare the files required for your conversion.\n\n# from a path.\n$index = DocumentFactory::makeFromPath('index.html', '/path/to/file');\n# ... or from your own stream.\n$stream = new LazyOpenStream('/path/to/file', 'r');\n$index = DocumentFactory::makeFromStream('index.html', $stream);\n// ... or from a string.\n$index = DocumentFactory::makeFromString('index.html', '\u003chtml\u003eFoo\u003c/html\u003e');\n\n$header = DocumentFactory::makeFromPath('header.html', '/path/to/file');\n$footer = DocumentFactory::makeFromPath('footer.html', '/path/to/file');\n$assets = [\n    DocumentFactory::makeFromPath('style.css', '/path/to/file'),\n    DocumentFactory::makeFromPath('img.png', '/path/to/file'),\n];\n\ntry {\n    $request = new HTMLRequest($index);\n    $request-\u003esetHeader($header);\n    $request-\u003esetFooter($footer);\n    $request-\u003esetAssets($assets);\n    $request-\u003esetPaperSize(Request::A4);\n    $request-\u003esetMargins(Request::NO_MARGINS);\n    $request-\u003esetScale(0.75);\n    \n    # store method allows you to... store the resulting PDF in a particular destination.\n    $client-\u003estore($request, 'path/you/want/the/pdf/to/be/stored.pdf');\n    \n    # if you wish to redirect the response directly to the browser, you may also use:\n    $client-\u003epost($request);          \n} catch (RequestException $e) {\n    # this exception is thrown if given paper size or margins are not correct.\n} catch (ClientException $e) {\n    # this exception is thrown by the client if the API has returned a code != 200.\n}\n```\n\nFor more complete usages, head to the [documentation](https://gotenberg.dev/).\n\n## Badges\n\n[![Travis CI](https://travis-ci.org/thecodingmachine/gotenberg-php-client.svg?branch=master)](https://travis-ci.org/thecodingmachine/gotenberg-php-client)\n[![Scrutinizer](https://scrutinizer-ci.com/g/thecodingmachine/gotenberg-php-client/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/thecodingmachine/gotenberg-php-client/?branch=master)\n","funding_links":[],"categories":["PHP","Clients"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fgotenberg-php-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodingmachine%2Fgotenberg-php-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fgotenberg-php-client/lists"}