Download the PHP package packvium/native-bridge without Composer

On this page you can find all versions of the php package packvium/native-bridge. 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 native-bridge

packvium/native-bridge

Optional native backend for Packvium. It uses a Rust shared library through PHP FFI when one is available, and otherwise uses the pure-PHP Packvium package.

Full documentation, the constraint reference and benchmarks live at packvium.com.

Install

PHP 7.4 or later is required. Enable ext-ffi and provide a compatible shared library only when you want the native backend; neither is required for the PHP fallback.

Quick start

The request is the same plain array packvium/packvium reads with ArrayCodec::pack() — the JSON document every Packvium engine accepts. Lengths and weights are strings, parsed into exact integers, so '0.1' is a tenth of a millimetre and never a rounded float.

The shared library is the packvium-ffi crate's C ABI build, named by platform: libpackvium_ffi.so on Linux, libpackvium_ffi.dylib on macOS and packvium_ffi.dll on Windows. If the extension, library or health check is unavailable, NativePacker selects the PHP backend instead of failing the packing request. Log backend() once at startup: it is how you learn that a deployment you believed was accelerated quietly fell back.

Omit the library path (or pass null) to always use the pure-PHP backend — useful in a test suite or on a host that never provisions the shared library:

The two backends are independent engines held to the same request and result contract. Each answer is independently validated, but they are not held to identical placements: on some requests the compiled engine chooses a different arrangement, or one that scores differently. Pin one backend if you need byte-identical plans across hosts.

That includes the ids: each placement's placement_id is derived from where it lies, so the same placement has the same id on either backend, and a different arrangement has different ids. Keep a lock or a fixed placement that quotes one with the plan it was read from.

Errors

A malformed request is refused before anything is solved, with the same message from either backend — invalid_request: <field>: <detail>, where <field> is a JSON Pointer into your request. How it reaches you differs:

Handle both until your deployment runs only one:

A request that is valid but does not fit completely is not an error on either backend: the result lists what was left out, and why, in unpacked_items. A native call that fails at runtime (a bad pointer, unparseable output) disables the library for the rest of the NativePacker's life and retries the same request in pure PHP.

Examples

Runnable, in examples/. Each one is a single file you can read top to bottom and execute without a project around it.

File What it shows
basic.php Pack through the bridge and report which backend answered.
shapes.php Items that are not their box: complementary wedges sharing one crate as convex_hull, and a cushion that compresses under load until the crush limit refuses it — the same numbers whichever backend loaded.

Running it both ways is the point: the same request comes back as a valid answer in the same shape whichever backend served it.

When to use it

Use this package when your deployment already manages the shared library and you want the native engine. For a zero-configuration installation, use packvium/packvium directly.

The Packvium family

One request and result contract, implemented independently in four engines (Rust, Python, PHP, JavaScript) and checked against each other on a shared fixture set. Python and PHP are held to byte-identical canonical results; Rust and the JavaScript fallback are held to independent validity and a per-fixture objective floor. Pick the package for your stack; mixing them in one system is safe.

Documentation, the constraint reference and the benchmarks are at packvium.com.

Package Install Source
Python — packvium pip install packvium packvium-python
PHP — packvium/packvium composer require packvium/packvium packvium-php
Rust — packvium packvium = "1.11" packvium-rust
Node.js — @packvium/engine npm install @packvium/engine packvium-node
Browser / WebAssembly — @packvium/browser npm install @packvium/browser packvium-wasm
PHP FFI bridge — packvium/native-bridge composer require packvium/native-bridge packvium-php-bridge
Python native selector — packvium-native from source until the native wheels ship packvium-python-adapter

Citation

If Packvium supports your research, cite it as software. GitHub's Cite this repository button reads CITATION.cff, and codemeta.json carries the same record in CodeMeta form.

License

MIT. See LICENSE.


All versions of native-bridge with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 packvium/native-bridge contains the following files

Loading the files please wait ...