PHP code example of innobrain / markitdown

1. Go to this page and download the library: Download innobrain/markitdown library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

innobrain / markitdown example snippets


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 

// 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');
bash
php artisan vendor:publish --tag="markitdown-config"
bash
php artisan markitdown:install
bash
which markitdown