1. Go to this page and download the library: Download rakshitbharat/pythoninphp 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/ */
rakshitbharat / pythoninphp example snippets
return [
// Define the path to your Python executable
'executable' => env('PYTHON_EXECUTABLE', 'python3'),
// Default execution timeout in seconds (null for no timeout)
'timeout' => env('PYTHON_TIMEOUT', 60),
];
use Rakshitbharat\Pythoninphp\Facades\Python;
$output = Python::run('app/Scripts/hello.py');
echo $output; // Prints standard output