fvhockney/latexcompiler
Composer 安装命令:
composer require fvhockney/latexcompiler
包简介
A LaTeX compiler for user provided data in Laravel
README 文档
README
This project aims to create an intuitive way for laravel users to create PDF documents through LaTeX with minimal pain.
I leverage the blade template to write the actual LaTeX code and compile with pdflatex. This allows for the use of {{ }} to drop in variables and use all of the normal blade commands.
Installation
Available through composer:
composer require fvhockney/latexcompiler
Configuration
Publish the configuration file:
php artisan vendor:publish --tag=fvlatex-config
This publishes the default configuration file to config/fvlatex.php where you can modify your default preferences.
NB: logging automatically merges from the vendor file fvlatexlogchannel.php to the default config/logging.php file on boot.
Usage
This packages is compatible with injection. You can use the fluent interface to pass in required and optional parameters.
Required
->with($data): (object|array) passes to the template to fill->in($view): (string) name of the view you wish to use to create the.texdocument->complie($name): (string) the name of the file you want to use without any extensions
Optional
->runs($runs): (integer) number of times you wantpdflatexto run, defaults to config which is initially set at 2->storagePath($path): (string path) overrides the default storage path in config...useful for multi user systems->deletePdf(): beta deletes the pdf from the storage path
Create Something
->run(): compiles the document in a build directory and moves it to the storage path. It then tears down the build directory->fillTemplate(): fills in the tempplate but doesn't run the shell commands to compile the PDF.
Getting results
->pdfUrl: called after->run()to get the storage location with the filename of the PDF.->template: called after->run()or->fillTemplateto get thetexstring
Try out
There is an example controller, tex template view, and form view included for you to try this out in your setup without having to waste time writing the form and tex files. Just copy the controller to your app/Http/Controllers, set up at GET route for the form and POST to the controller to get started.
IMPORTANT!!
Make sure you have tex installed on your system and that you provide the fully qualified path to where pdflatex is located.
LaTeX can be pretty finicky, so I highly recommend that you test your templates extensively on a local system before deploying. Also, there is currently no escaping of user inputs, so if your users input a reserved character in Tex, it will not be escaped automatically and could break the compilation sequence.
TODO
- Add to <pakagist.org>
- Add ability to escape user inputs
- Add ability to compile assets
- Find a better way to implement logging
- Give user more control over logging
- Add options to upload to cloud
Collaboration
I would love to hear your thoughts and ideas about how to make this package better! Feel free to contact me, fork, or submit a pull request!
fvhockney/latexcompiler 适用场景与选型建议
fvhockney/latexcompiler 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 3.24k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 06 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「latex」 「laravel」 「latex compiler」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fvhockney/latexcompiler 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fvhockney/latexcompiler 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fvhockney/latexcompiler 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
LaTeX formula to PNG
PHP library for (La)TeX abstraction
A token based Javascript parser/minifier designed for compressing inline scripts on the fly, written in PHP
A token based CSS Document parser and minifier written in PHP
A token based HTML document parser and minifier. Minify HTML documents including inline CSS, Javascript, and SVG's on the fly. Extract document text, attributes, and fragments. Full test suite.
Simple class that compiles Laravel Blade files
统计信息
- 总下载量: 3.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-05