PHP Classes

How to Implement a PHP Python Integration to Execute Python scripts from PHP Using the Package Laravel Python: Execute scripts written in Python

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-08-21 (1 month ago) RSS 2.0 feedNot enough user ratingsTotal: 20 This week: 1All time: 11,282 This week: 41Up
Version License PHP version Categories
laravel-python 1.0.0Custom (specified...7Console, Language, PHP 7
Description 

Author

This package can execute scripts written in Python.

It provides a Laravel service class that reads a configuration file and registers a class that executes scripts in Python.

The class to execute Python scripts can take the script's file name and run it using the Python command that can be used from the command line interface.

Innovation Award
PHP Programming Innovation award nominee
August 2024
Nominee
Vote
Python is a scripting language used to build many useful applications and libraries, including some artificial intelligence libraries and applications.

PHP can use those Python applications and libraries by calling the Python command line interface program.

This package provides a means to execute Python scripts using one Laravel service class.

Manuel Lemos
Picture of Bhavin Gajjar
  Performance   Level  
Name: Bhavin Gajjar <contact>
Classes: 3 packages by
Country: India India
Innovation award
Innovation award
Nominee: 2x

Documentation

Run Python scripts inside your Laravel

Latest Version on Packagist Total Downloads GitHub Actions

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

Installation

You can install the package via composer:

composer require bhavingajjar/laravel-python

Publish Configuration File

php artisan vendor:publish --provider="Bhavingajjar\LaravelPython\LaravelPythonServiceProvider" --tag="config"

Usage

Using Dependency injection

use Bhavingajjar\LaravelPython\LaravelPython;

$python = new LaravelPython();
$result = $python->run('hello.py');

Using Dependency injection

public function index(LaravelPython $python){
    $result = $python->run('hello.py');
}

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email gajjarbhavin22@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


  Files folder image Files (17)  
File Role Description
Files folder image.github (1 directory)
Files folder imageconfig (1 file)
Files folder imagesrc (3 files, 1 directory)
Files folder imagetests (1 file)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (17)  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files (17)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file main.yml Data Auxiliary data

  Files folder image Files (17)  /  config  
File Role Description
  Accessible without login Plain text file config.php Aux. Configuration script

  Files folder image Files (17)  /  src  
File Role Description
Files folder imageCommands (1 file)
  Plain text file LaravelPython.php Class Class source
  Plain text file LaravelPythonFacade.php Class Class source
  Plain text file LaravelPythonServiceProvider.php Class Class source

  Files folder image Files (17)  /  src  /  Commands  
File Role Description
  Plain text file RunPython.php Class Class source

  Files folder image Files (17)  /  tests  
File Role Description
  Plain text file ExampleTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:20
This week:1
All time:11,282
This week:41Up