定制 avvertix/html-shot 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

avvertix/html-shot

最新稳定版本:v0.1.0

Composer 安装命令:

composer require avvertix/html-shot

包简介

HTML to image rendering for PHP, powered by Rust and Takumi

README 文档

README

HTML to image rendering for PHP, powered by Rust and Takumi. Generate Open Graph images and more from HTML/CSS without headless browser overhead.

Features

tbd

HTML & CSS Support

Input Behaviour
<style> tags CSS extracted and applied as a stylesheet
Inline style="..." Promoted to a generated CSS class rule
<img src="..."> Local paths and data URIs supported
CSS background-image: url(...) Local paths and data URIs supported
<br> Rendered as a newline
<html>, <head>, <body> Transparent wrappers, stripped
All other elements Rendered as Takumi container nodes (class, id, tagName forwarded)

Takumi's layout engine supports Flexbox, CSS Grid, tw Tailwind utility classes, and CSS animations.

Installation

composer require avvertix/html-shot

Requirements

  • PHP 8.2 or higher
  • FFI extension enabled ext-ffi | enabled (ffi.enable = true in php.ini) |

Quick Example

tbd

Development

git clone https://github.com/avvertix/html-shot.git
cd html-shot

# Install PHP dependencies
composer install

# Build the Rust library
cd rust && cargo build --release

Build the native library

The Rust library must be compiled for your target platform. A pre-built binary is attached to each GitHub release or you can build your own.

cd vendor/avvertix/html-shot/rust
cargo build --release

Then copy the compiled library to the lib/ directory at the package root:

Platform Source Destination
Linux target/release/libhtml_shot.so ../lib/libhtml_shot.so
macOS target/release/libhtml_shot.dylib ../lib/libhtml_shot.dylib
Windows target/release/html_shot.dll ../lib/html_shot.dll

The C header is auto-generated by cbindgen and written to include/html_shot.h during the build.

Troubleshooting

Enabling ext-ffi

Check whether FFI is active:

php -m | grep FFI

If it is not listed, add the following to your php.ini and restart PHP-FPM / your web server:

extension=ffi
ffi.enable=true

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE file for details.

Credits

Powered by Takumi

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固