Download the PHP package iliaal/statgrab without Composer

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

statgrab

Tests Version License: PHP-3.01 Follow @iliaa

A native PHP extension wrapping libstatgrab, the cross-platform system-statistics library. Originally released to PECL in 2006 against libstatgrab 0.6; the 2.0.0 line is a full modernization for the PHP 8.0+ era against libstatgrab 0.92+.

Supports PHP 8.0 through 8.5 on glibc Linux, musl, macOS, and *BSD.

The Problem

Reading system stats from PHP usually means one of three bad options:

libstatgrab is the right primitive: cross-platform, well-tested, in the package manager of every modern Unix. But the 2006 PECL binding has not shipped a PHP 8 build, and its 2006 BC quirks (stringified counters, swapped page-stat keys, a flat name_list for users) made the old extension awkward even when you could compile it.

✨ Key Features

Feature Notes
Cross-platform glibc Linux, musl, macOS, FreeBSD
Procedural + OO API 2006 sg_* function names preserved; modern Statgrab class on top
Bundled libstatgrab option Vendored 0.92.1 with a leak-fix patch; resulting .so has no runtime dependency on libstatgrab.so
Modern types Counters returned as 64-bit int, not stringified numbers
Modern PHP errors E_WARNING on library failure, ArgumentCountError for arg-count violations
BC-preserved 2006 names Drop-in for callers of the original PECL extension, with the 2.0 BC notes documented below

⚖️ Why native

The case for a native extension is the failure modes of the alternatives:

statgrab calls libstatgrab in-process. libstatgrab handles the per-OS path (Linux /proc, FreeBSD kvm, macOS host_* APIs) and exposes a single typed surface. The extension wraps that surface with no allocation per call beyond the result array.

🚀 Quick Start

PIE (recommended on PHP 8.x)

PIE is the PHP Foundation's PECL successor. It installs from Packagist, builds against the active php-config, and produces a loadable .so. Make sure libstatgrab is installed first (see the From-source section below for the system package names), then:

Then add extension=statgrab to your php.ini.

PECL

The package remains in the PECL channel for legacy installers:

From source

Then add extension=statgrab to your php.ini.

config.m4 resolves libstatgrab through pkg-config first; if that fails it falls back to a path probe (/usr and /usr/local). Pass --with-statgrab=<prefix> to point at a custom install.

Bundled libstatgrab (statically linked, leak-fixed)

The repo carries a vendored copy of libstatgrab 0.92.1 under vendor/libstatgrab/ with one local patch (see vendor/libstatgrab/LOCAL_PATCHES.md) that fixes a process-exit leak upstream hasn't released yet. To use it:

The resulting .so has no libstatgrab.so runtime dependency.

The vendored libstatgrab tree stays LGPL 2.1+ (see LICENSE.libstatgrab); the extension code stays PHP-3.01 (see LICENSE). Dynamic-link or static-link, neither license infects the other.

API

Procedural

The 2006 function names are preserved.

Object-oriented

Class constants:

The SG_* global constants from 2006 are still defined for BC.

Errors

Library-side errors emit E_WARNING with the libstatgrab error string and code, and the function returns false. The OO surface follows the same convention. Argument-count violations on no-arg functions throw ArgumentCountError per modern PHP convention.

Notable 2.0 BC breaks

See CHANGELOG.md for the full list.

🔗 PHP Performance Toolkit

Native PHP extensions for the kinds of work pure-PHP libraries handle slowly:

License

PHP License 3.01.


Follow @iliaa on XBlog

If this saved you from parsing /proc by hand, ⭐ star it!


All versions of statgrab with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
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 iliaal/statgrab contains the following files

Loading the files please wait ...