Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

From source

Building from source requires a Rust toolchain (1.85 or later) and PHP 8.1 or later with development headers.

# Clone the repository
git clone https://github.com/mosuka/laurus.git
cd laurus/laurus-php

# Build the native extension
cargo build --release

# Copy the shared library to the PHP extensions directory
# (the exact path depends on your OS and PHP version)
cp ../target/release/liblaurus_php.so $(php -r "echo ini_get('extension_dir');")

Then add the extension to your php.ini:

extension=laurus_php.so

Alternatively, you can load the extension on the command line:

php -d extension=liblaurus_php.so your_script.php

Verify

<?php

use Laurus\Index;

$index = new Index();
echo $index;  // Index()

Requirements

  • PHP 8.1 or later with development headers (php-dev / php-devel)
  • Rust toolchain 1.85 or later with Cargo
  • No runtime dependencies beyond the compiled native extension