innobrain/markitdown
Composer 安装命令:
composer require innobrain/markitdown
包简介
Laravel bindings for markitdown.
README 文档
README
Laravel bindings for markitdown.
Installation
- Install the package via composer:
composer require innobrain/markitdown
- Publish the configuration file:
php artisan vendor:publish --tag="markitdown-config"
- Run the installation command if you want the package to manage your
markitdowninstallation:
php artisan markitdown:install
This will:
- Set up a Python virtual environment with the required dependencies
- Add the setup script to your project's composer.json
- Ensure the environment is kept up to date with future composer updates
Alternative Installation Methods
If you prefer not to use the built-in virtual environment, you can disable it in your .env file or in the config:
MARKITDOWN_USE_VENV_PACKAGE=false
Then install markitdown manually using one of these methods:
Using pip directly:
pip install markitdown
Using pipx (Recommended for manual installation):
On macOS:
brew install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions with --global argument
Or see how to install on other platforms.
After installing pipx, you can install markitdown with:
pipx install markitdown
When not using the built-in virtual environment, you'll need to set the path to the markitdown executable in your .env file. You can retrieve the path with:
which markitdown
MARKITDOWN_EXECUTABLE=/path/to/markitdown
Also, when running the script anywhere but the console, you need to set the PATH, as php-fpm does not have
access to the PATH variable. You can do this by adding the following to your .env file:
MARKITDOWN_SYSTEM_PATH=<your path>
Configuration
The package's configuration will be published to config/markitdown.php. Here are the available options:
return [ /* * Use this to set the timeout for the process. Default is 30 seconds. */ 'process_timeout' => env('MARKITDOWN_PROCESS_TIMEOUT', 30), /* * Use this to set the path to the markitdown executable. If not set, * the binary will be searched in the PATH. Will be ignored * if use_venv_package is set to true. */ 'executable' => env('MARKITDOWN_EXECUTABLE', 'markitdown'), /* * This will override the above setting and use the new locally installed package. */ 'use_venv_package' => env('MARKITDOWN_USE_VENV_PACKAGE', true), /* * This is needed when you want to run markitdown in php-fpm. One dependency * of markitdown requires PATH to be set. If you are running in a console, * this is not needed. */ 'system' => [ 'path' => env('MARKITDOWN_SYSTEM_PATH', ''), ], /* * The path where temporary files will be stored. This directory must be writable * by the web server. Defaults to storage/app/private/markitdown_tmp */ 'temporary_directory' => env('MARKITDOWN_TEMPORARY_DIRECTORY', storage_path('app/private/markitdown_tmp')), ];
Usage
// convert a file: $markdown = \Innobrain\Markitdown\Facades\Markitdown::convert('/path/to/file.docx'); // or convert a file you already have in memory: $file = file_get_contents('/path/to/file.docx'); $markdown = \Innobrain\Markitdown\Facades\Markitdown::convertFile($file, '.docx');
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
innobrain/markitdown 适用场景与选型建议
innobrain/markitdown 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.32k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2024 年 12 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「Innobrain」 「markitdown」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 innobrain/markitdown 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 innobrain/markitdown 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 innobrain/markitdown 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel package to joyfully interact with the onOffice API
Package to extract the enterprise configuration
This is my package laravel-openimmo
This is my package laravel-libpostal
Alfabank REST API integration
Laravel package for Accurate Online API integration.
统计信息
- 总下载量: 10.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-16