https://github.com/choowx/satori-php
Run Satori — enlightened library to convert HTML and CSS to SVG, using PHP
https://github.com/choowx/satori-php
convert css html image php satori satori-php svg
Last synced: 5 months ago
JSON representation
Run Satori — enlightened library to convert HTML and CSS to SVG, using PHP
- Host: GitHub
- URL: https://github.com/choowx/satori-php
- Owner: choowx
- License: mit
- Created: 2023-01-01T15:09:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-01-12T07:32:55.000Z (6 months ago)
- Last Synced: 2026-01-14T14:49:47.562Z (5 months ago)
- Topics: convert, css, html, image, php, satori, satori-php, svg
- Language: PHP
- Homepage:
- Size: 528 KB
- Stars: 17
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README

# Run Satori — enlightened library to convert HTML and CSS to SVG, using PHP
[](https://packagist.org/packages/choowx/satori-php)
[](https://github.com/choowx/satori-php/actions/workflows/run-tests.yml)
[](https://packagist.org/packages/choowx/satori-php)
[Satori](https://github.com/vercel/satori) — enlightened library to convert HTML and CSS to SVG.
This package makes it easy to run Satori using PHP.
## Installation
You can install the package via composer:
```bash
composer require choowx/satori-php
```
This package relies on the `satori` and `html-react-parser` js packages being available on your system. In most cases you can accomplish this by issues these commands in your project.
```bash
npm install satori
npm install html-react-parser
```
## Usage
```php
use Choowx\Satori\Satori;
$svg = Satori::html('
hello, world')->convert();
// $svg = 'hello, world')
->width(600)
->height(315)
->convert();
// $svg = ' Satori currently supports three font formats: TTF, OTF and WOFF. Note that WOFF2 is not supported at the moment.
```php
use Choowx\Satori\Font;
use Choowx\Satori\Satori;
$svg = Satori::html('
hello, world')
->withFonts([
Font::path('/path/to/Roboto-Regular.ttf')
->name('Roboto')
->weight(400)
->style('regular'),
Font::path('/path/to/Roboto-Bold.ttf')
->name('Roboto')
->weight(700)
->style('bold'),
])
->convert();
```
## Testing
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](https://github.com/choowx/satori-php/blob/main/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Choo Wen Xuan](https://github.com/choowx)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.