PHPackages                             laleksandrov/larapy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. laleksandrov/larapy

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

laleksandrov/larapy
===================

A Laravel package to provide Python script helpers and manage Python resources.

1.0.1(1y ago)01MITPHPPHP ^8.2

Since Feb 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/laleksandrov/LaraPy)[ Packagist](https://packagist.org/packages/laleksandrov/larapy)[ RSS](/packages/laleksandrov-larapy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

LaraPy
======

[](#larapy)

LaraPy is a Laravel package designed to make managing and executing Python scripts seamless. It provides helper functions to simplify referencing Python scripts in your Laravel project and executing them with arguments.

Features
--------

[](#features)

- `python_path()`: Resolve the absolute path to Python scripts located in `resources/python`.
- `python($script, $args = [])`: Execute Python scripts and pass arguments dynamically.

Installation
------------

[](#installation)

1. Install LaraPy via Composer:

```
   composer require laleksandrov/larapy
```

1. After installing, the package automatically creates the directory `resources/python`, where your Python scripts should be placed. If the directory does not exist, create it manually:

```
   mkdir -p resources/python
```

Usage
-----

[](#usage)

### Referencing Python Scripts

[](#referencing-python-scripts)

LaraPy provides the `python_path()` helper to get the absolute path of a Python script within `resources/python`.

#### Example:

[](#example)

```
$scriptPath = python_path('example.py');

// Output: /absolute/path/to/resources/python/example.py
```

### Executing Python Scripts

[](#executing-python-scripts)

LaraPy allows you to execute Python scripts using the `python()` helper. You can pass arguments as an array.

#### Example:

[](#example-1)

If you have a script called `example.py` in `resources/python`:

```
# example.py
import sys

if len(sys.argv) > 1:
    print(f"Arguments received: {', '.join(sys.argv[1:])}")
else:
    print("No arguments provided.")
```

Run the script with arguments in PHP:

```
$output = python('example.py', ['arg1', 'arg2']);
echo $output;

// Output: Arguments received: arg1, arg2
```

#### Error Handling:

[](#error-handling)

If the script fails, the helper throws a `Symfony\Component\Process\Exception\ProcessFailedException`. You can handle this exception as follows:

```
try {
    $output = python('example.py', ['arg1']);
    echo $output;
} catch (ProcessFailedException $e) {
    echo $e->getMessage();
}
```

Troubleshooting
---------------

[](#troubleshooting)

1. **`resources/python` Directory Missing?**If the `resources/python` folder wasn't automatically created during installation, you can manually create it:

```
   mkdir -p resources/python
```

1. **Python Not Found?**Ensure Python is installed on your system and accessible via the `python` command. If your environment uses `python3`, update the `python()` helper's command to use `python3`.

Requirements
------------

[](#requirements)

- PHP version `^8.0`
- Laravel version `^10.0`
- Python installed and accessible in your environment

Contributing
------------

[](#contributing)

We welcome contributions! To contribute:

1. Fork this repository.
2. Implement your feature or bugfix in a new branch.
3. Submit a Pull Request.

Author
------

[](#author)

- **laleksandrov** ([GitHub Profile](https://github.com/laleksandrov))

License
-------

[](#license)

This package is licensed under the [MIT license](LICENSE).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance44

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

445d ago

PHP version history (2 changes)1.0.0PHP ^8.0

1.0.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/225c5c30892be557df4417ff5c3aa63d581c22552f5d30fd78b4607df9af4fa6?d=identicon)[laleksandrov](/maintainers/laleksandrov)

---

Top Contributors

[![laleksandrov](https://avatars.githubusercontent.com/u/7546712?v=4)](https://github.com/laleksandrov "laleksandrov (8 commits)")

### Embed Badge

![Health badge](/badges/laleksandrov-larapy/health.svg)

```
[![Health](https://phpackages.com/badges/laleksandrov-larapy/health.svg)](https://phpackages.com/packages/laleksandrov-larapy)
```

###  Alternatives

[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M212](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)[mrmarchone/laravel-auto-crud

Laravel Auto CRUD helps you streamline development and save time.

28711.8k2](/packages/mrmarchone-laravel-auto-crud)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
