Download the PHP package pyhp/starter without Composer

On this page you can find all versions of the php package pyhp/starter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package starter

PyHP starter

A small, complete PHP project that uses Python's pandas and matplotlib through PyHP. Copy it to start your own app.

create-project installs PyHP and runs vendor/bin/pyhp setup, which creates a Python virtual environment in .venv and installs the exact versions in pyhp.lock. With uv installed it can even download Python 3.12 for you; without it, PyHP uses the Python you have (3.10 or newer).

Requirements: PHP 8.2+ (64-bit) and Composer. Python is optional when uv is installed.

What's inside

Path What it is
src/SalesReport.php pandas work behind plain PHP methods that return arrays. Copy this pattern: keep Python inside a few classes and the rest of your app never needs to know.
src/RevenueChart.php A matplotlib chart rendered to SVG for a web page.
bin/report A sales report on the command line.
public/index.php A web page with the report and the chart.
data/orders.csv Sample data.
tests/ Pest tests that run against the real Python environment.
composer.json extra.pyhp lists the Python version and packages the app needs.
pyhp.lock The exact Python package versions, for every OS. Commit it.

Everyday commands

Command What it does
composer setup Make .venv match pyhp.lock exactly (vendor/bin/pyhp setup --exact). Run it after pulling changes.
vendor/bin/pyhp lock Update pyhp.lock after changing extra.pyhp.requirements.
composer info Check PHP, Python, the venv and the packages (vendor/bin/pyhp info).
composer test Run the tests.
composer serve Serve public/ on http://localhost:8000.

Adding a Python package

  1. Add it to extra.pyhp.requirements in composer.json, e.g. "scikit-learn>=1.5".
  2. Run vendor/bin/pyhp lock, then composer setup.
  3. Commit composer.json and pyhp.lock.

Composer packages you install can declare their own Python requirements too; pyhp setup collects them automatically.

In production

Run the same two commands on deploy, after composer install --no-dev:

Each PHP request in this starter starts a Python worker and imports pandas, which takes a few hundred milliseconds. That's fine for reports and back-office pages. For busy pages, do the Python work in a queue worker or a long-running process and keep one session alive. The PyHP docs explain the options.

License

MIT


All versions of starter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
pyhp/pyhp Version ^0.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pyhp/starter contains the following files

Loading the files please wait ...