wxm / laravel-venomancer
venomancer for laravel
v0.1.0
2020-09-07 04:10 UTC
Requires
- php: >=7.1.3
- wxm/venomancer: ^0.0.7
This package is auto-updated.
Last update: 2024-11-07 20:04:30 UTC
README
Venomancer 的 Laravel/Lumen 套件.
- 基于 puppeteer 的 headless-chrome 能力封装及性能优化
- 支持 html 渲染生成图片
- 支持 url 访问生成图片
- TODO 其他 headless-chrome 能力
- TODO 其他 API
快速开始
npm install venomancer --save composer require wxm/laravel-venomancer
Laravel
-
注册 ServiceProvider (laravel > 5.5 不需要注册):
Wxm\LaravelVenomancer\ServiceProvider::class
-
发布配置:
php artisan vendor:publish --provider="Wxm\LaravelVenomancer\ServiceProvider" --force
Lumen
-
注册 ServiceProvider:
bootstrap/app.php
下添加$app->register(Wxm\LaravelVenomancer\ServiceProvider::class);
-
手动复制配置文件
使用
<?php $router->get('highchart', function () { return response()->make( highchart([ 'chart' => [ 'type' => 'line', ], 'plotOptions' => [ 'series' => [ 'animation' => false ] ], 'title' => [ 'text' => '标题' ], 'credits' => [ 'enabled' => false ], 'series' => [ [ 'name' => '数值', 'data' => [1, 2, 3, 4] ] ] ]), 200, ['Content-Type' => 'image/jpeg'] ); }); // 访问 /highchart 试试 // 选项详情请查看 highchart api
License
The MIT License (MIT). Please see License File for more information.