{"id":19545406,"url":"https://github.com/ueberdosis/pandoc","last_synced_at":"2025-04-09T16:20:40.947Z","repository":{"id":37941066,"uuid":"248034409","full_name":"ueberdosis/pandoc","owner":"ueberdosis","description":"A PHP wrapper for Pandoc to convert any text format in any other text format","archived":false,"fork":false,"pushed_at":"2023-03-13T23:56:42.000Z","size":82,"stargazers_count":72,"open_issues_count":4,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-14T02:44:27.281Z","etag":null,"topics":["laravel","pandoc","php"],"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/ueberdosis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"ueberdosis","open_collective":"tiptap","custom":"https://tiptap.dev/pricing"}},"created_at":"2020-03-17T17:40:01.000Z","updated_at":"2024-03-19T11:20:08.000Z","dependencies_parsed_at":"2023-09-24T09:30:59.270Z","dependency_job_id":null,"html_url":"https://github.com/ueberdosis/pandoc","commit_stats":{"total_commits":112,"total_committers":8,"mean_commits":14.0,"dds":0.3928571428571429,"last_synced_commit":"c5f16d52170e0622d6d3ef8350e08d0799809049"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberdosis%2Fpandoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberdosis%2Fpandoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberdosis%2Fpandoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ueberdosis%2Fpandoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ueberdosis","download_url":"https://codeload.github.com/ueberdosis/pandoc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065285,"owners_count":21041872,"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":["laravel","pandoc","php"],"created_at":"2024-11-11T03:38:32.209Z","updated_at":"2025-04-09T16:20:40.928Z","avatar_url":"https://github.com/ueberdosis.png","language":"PHP","funding_links":["https://github.com/sponsors/ueberdosis","https://opencollective.com/tiptap","https://tiptap.dev/pricing"],"categories":[],"sub_categories":[],"readme":"# Pandoc PHP Package\n[![](https://img.shields.io/packagist/v/ueberdosis/pandoc.svg)](https://packagist.org/packages/ueberdosis/pandoc)\n[![Integrate](https://github.com/ueberdosis/pandoc/workflows/run-tests/badge.svg?branch=main)](https://github.com/ueberdosis/pandoc/actions)\n[![](https://img.shields.io/packagist/dt/ueberdosis/pandoc.svg)](https://packagist.org/packages/ueberdosis/pandoc)\n[![Sponsor](https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub)](https://github.com/sponsors/ueberdosis)\n\nIf you need to convert text files from one format to another, [pandoc](https://pandoc.org/) is your swiss-army knife. This package is a PHP wrapper for pandoc.\n\n## Installation\nYou can install the package via composer:\n\n```bash\ncomposer require ueberdosis/pandoc\n```\n\nThis package is a wrapper for the command-line tool pandoc. Don’t forget to install pandoc. Here is an example for Ubuntu:\n\n```bash\nsudo apt-get update\nsudo apt-get install -y wget\nsudo mkdir -p /usr/src/pandoc\ncd /usr/src/pandoc\nsudo wget https://github.com/jgm/pandoc/releases/download/2.15/pandoc-2.15-1-amd64.deb\nsudo dpkg -i pandoc-2.15-1-amd64.deb\n```\n\n[More examples are available in the pandoc documentation](https://pandoc.org/installing.html)\n\n## Usage\n\n### Return the converted text as string\n```php\n$output = (new \\Pandoc\\Pandoc)\n    -\u003efrom('markdown')\n    -\u003einput('# Test')\n    -\u003eto('html')\n    -\u003erun();\n```\n\n### Use a file as input and write a file as output\n```php\n(new \\Pandoc\\Pandoc)\n    -\u003efrom('markdown')\n    -\u003einputFile('tests/data/example.md')\n    -\u003eto('plain')\n    -\u003eoutput('tests/temp/example.txt')\n    -\u003erun();\n```\n\n### Change path to Pandoc\n```php\nnew \\Pandoc\\Pandoc([\n    'command' =\u003e '/usr/local/bin/pandoc',\n]);\n```\n\n### Change working directory\n```php\n(new \\Pandoc\\Pandoc)-\u003ecwd('/tmp/pandoc/');\n```\n\n### List available input formats\n```php\n(new \\Pandoc\\Pandoc)-\u003elistInputFormats();\n```\n\n### List available output formats\n```php\n(new \\Pandoc\\Pandoc)-\u003elistOutputFormats();\n```\n\n### Write a log file\n```php\necho (new \\Pandoc\\Pandoc)\n    -\u003efrom('markdown')\n    -\u003einput('# Markdown')\n    -\u003eto('html')\n    -\u003elog('log.txt')\n    -\u003erun();\n```\n\n### Retrieve Pandoc version\n```php\necho (new \\Pandoc\\Pandoc)-\u003eversion();\n```\n\n### Use magic methods to make calls shorter\n```php\n$output = (new \\Pandoc\\Pandoc)\n    -\u003efromMarkdown('# Test')\n    -\u003etoHtml('tests/temp/example.txt')\n    -\u003erun();\n```\n\n### Pass options to Pandoc\n```php\necho (new \\Pandoc\\Pandoc)\n    -\u003efromMarkdown('# Test')\n    -\u003etoHtml('tests/temp/example.txt')\n    -\u003eoption('fail-if-warnings')\n    -\u003eoption('data-dir', './tmp')\n    -\u003erun();\n```\n\nSee https://pandoc.org/MANUAL.html for a full list of available options\n\n### Laravel Facade\nThis package includes a Laravel facade for people that like that little bit of syntactic sugar.\n\n```php\necho \\Pandoc\\Facades\\Pandoc::version();\n```\n\n### Exceptions\nIf something went wrong, the package throws a generic `\\Symfony\\Component\\Process\\Exception\\ProcessFailedException`. There are even a few specific exceptions.\n\n* \\Pandoc\\Exceptions\\PandocNotFound\n* \\Pandoc\\Exceptions\\InputFileNotFound\n* \\Pandoc\\Exceptions\\UnknownInputFormat\n* \\Pandoc\\Exceptions\\UnknownOutputFormat\n* \\Pandoc\\Exceptions\\LogFileNotWriteable\n* \\Pandoc\\Exceptions\\BadMethodCall\n\n### Testing\n``` bash\ncomposer test\n```\n\n### Changelog\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Credits\n\n- [Hans Pagel](https://github.com/hanspagel)\n- [Miguel Piedrafita](https://github.com/m1guelpf)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fueberdosis%2Fpandoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fueberdosis%2Fpandoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fueberdosis%2Fpandoc/lists"}