Download the PHP
package hop-top/c12n without Composer
On this page you can find all versions of the php package
hop-top/c12n. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor hop-top Package c12n Short Description LLM request classification engine — PHP FFI bindings over the Rust core License
MIT
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.
LLM request classification engine — PHP FFI bindings over the Rust core.
Status
Alpha — initial scaffold. The FFI surface is wired against the
cbindgen-generated header in c12n-core/include/libc12n_core.h; the
native libc12n_core.{so,dylib,dll} is downloaded by the post-install
script (T-0143, not yet implemented). For local development, build the
cdylib from c12n-core/ and either symlink it into runtime/lib/ or
set C12N_CORE_LIB_PATH.
Requirements
PHP 8.4+ — matches the composer.json floor ("php": "^8.4"); FFI
is stable from 8.1 onward (experimental in 7.4/8.0).
ext-ffi — PHP's FFI extension. Bundled with most distributions
but disabled by default; enable in php.ini with ffi.enable=true
(CLI is usually fine; web SAPI requires ffi.enable=preload and a
preload script).
libc12n_core — the Rust cdylib. Downloaded automatically by
Composer post-install once T-0143 ships; before then, build from
c12n-core and point C12N_CORE_LIB_PATH at the artifact.
Install
The post-install-cmd hook (registered now, implemented in T-0143)
fetches the matching libc12n_core tarball from
https://github.com/hop-top/c12n/releases/download/{tag}/...,
SHA256-verifies it, and extracts into vendor/hop-top/c12n/runtime/lib/.
Quick start
Native library resolution
HopTop\C12n\Ffi::libPath() resolves the path to libc12n_core in this
order (ADR-0002 §4):
C12N_CORE_LIB_PATH env var — explicit override for airgapped /
sandboxed installs.
composer.json#extra.c12n-core.local-path — project-local override,
useful when developing against a sibling cdylib checkout.
Default: runtime/lib/libc12n_core.{so,dylib,dll} relative to this
package, populated by the post-install Installer.
Header contract
HopTop\C12n\Ffi::CDEF mirrors the four public symbols emitted by
c12n-core/include/libc12n_core.h:
PHP's FFI parser does not understand the C preprocessor (`#include
`, `#ifdef`, etc.), so the cbindgen header is **not** fed
directly to `FFI::cdef`. Instead the four prototypes are inlined as a
string constant. Any change to the FFI surface in `c12n-core/src/ffi.rs`
that affects the four symbols above requires updating `Ffi::CDEF`.
## Development
### FFI integration suite
`tests/PipelineFfiIntegrationTest.php` exercises the full roundtrip
against the real `libc12n_core` cdylib. The suite skips automatically
when the cdylib is not on disk, so `composer test` stays green on
fresh clones.
To run it end-to-end:
If `C12N_CORE_LIB_PATH` is unset, the suite resolves the cdylib at
`/target/debug/libc12n_core.{dylib,so,dll}` relative to
this package — the same path `cargo build -p hop-top-c12n-core`
populates from the workspace root.
## Troubleshooting
| Symptom | Fix |
|----------------------------------------------------------|-----|
| `FFI is not enabled` | Add `ffi.enable=true` to `php.ini`. |
| `c12n: native library not found at ...` | Run `composer install` to trigger the post-install download, or set `C12N_CORE_LIB_PATH=/abs/path/libc12n_core.dylib`. |
| `c12n: c12n_pipeline_new returned null` | Malformed config JSON or tokio runtime init failure. Check `maxConcurrency` is positive and `timeoutMs` fits in `u64`. |
| `c12n: pipeline is closed` | The pipeline was explicitly closed (or `__destruct`ed) before `evaluate()`. Construct a fresh `Pipeline`. |
| `c12n: ` (from `evaluate`) | The Rust core returned a JSON error envelope. The message is the verbatim string from `c12n_pipeline_evaluate`. |
## References
- ADR-0002 — `docs/adr/0002-c12n-php-ffi-binding.md` — locked decisions.
- `c12n-core/include/libc12n_core.h` — cbindgen output (source of truth
for the FFI surface).
- `c12n_cgo.go` / `c12n-py/src/lib.rs` — reference bindings whose API
surface c12n-php mirrors.
Requiresphp Version
^8.4 ext-ffi Version
* hop-top/kit Version
^0.5
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 hop-top/c12n contains the following files
Loading the files please wait ...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.