Polars-PHP Documentation#
A PHP extension bringing the power of Polars DataFrames to PHP.
Note
Some features are not yet available. Look in GitHub issues for updates.
Installation#
Pre-built Binaries#
Pre-built binaries are available for Linux and macOS. There were compiled for PHP 8.3, 8.4 and 8.5. Download the appropriate binary for your platform from the releases page.
Building from Source#
# Clone the repository
git clone https://github.com/pjpawel/polars-php.git
cd polars-php/php
# Build the extension
composer build:relese
# Verify installation
php -d extension=../target/release/libpolars_php.so -m | grep polars
Quick Example#
<?php
use Polars\DataFrame;
use Polars\Expr;
// Create a DataFrame from array
$df = new DataFrame([
'name' => ['Alice', 'Bob', 'Charlie'],
'age' => [25, 30, 35],
'city' => ['NYC', 'LA', 'Chicago']
]);
echo $df;
// Filter using expressions
$expr = Expr::col('age')->gt(25);
$result = $df->select([$expr]);
API Reference#
Classes
- DataFrame
- Constructor
- Static Methods
- Properties
- Series Access
- Dimensions
- Array Access
- Row Selection
- Aggregations
- Selection
- Core Manipulation
- Row/Column Manipulation
- Export/Row Access
- DataFrame Operations
- Advanced Operations
- Column Mutation
- Sequential Operations
- Conversion
- Partitioning
- Pivot
- Merge
- Advanced Joins
- SQL
- Deprecated
- Descriptive Methods
- Sampling
- Utilities
- Output
- LazyFrame
- LazyGroupBy
- Series
- Expr
- DataType
- Exception
- ClosedInterval
Requirements#
PHP 8.3+
Linux or macOS (Windows not currently supported)
Rust toolchain (for building from source)
License#
MIT License – see LICENSE for details.