PHPackages                             arraypress/wp-server-utils - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. arraypress/wp-server-utils

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arraypress/wp-server-utils
==========================

A lean WordPress library for server environment detection and basic system information

014PHP

Since Nov 12Pushed 6mo agoCompare

[ Source](https://github.com/arraypress/wp-server-utils)[ Packagist](https://packagist.org/packages/arraypress/wp-server-utils)[ RSS](/packages/arraypress-wp-server-utils/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

WordPress Server Utilities
==========================

[](#wordpress-server-utilities)

A lightweight WordPress library focused on server environment detection and basic system information for plugin developers. Complements WordPress core functions without duplication.

Features
--------

[](#features)

- 🖥️ **Server Detection**: Apache, Nginx, LiteSpeed, IIS identification
- 🔍 **Environment Detection**: Localhost, staging, production detection
- 🏢 **Hosting Platform Detection**: WP Engine, Kinsta, SiteGround, etc.
- 📊 **PHP Information**: Version, extensions, memory, configuration checks
- 💻 **System Basics**: OS detection, disk space, load averages
- 🎯 **Plugin-Focused**: Essential functionality plugin developers need

Requirements
------------

[](#requirements)

- PHP 7.4 or later
- WordPress 5.0 or later

Installation
------------

[](#installation)

```
composer require arraypress/wp-server-utils
```

Usage
-----

[](#usage)

### Server Detection

[](#server-detection)

```
use ArrayPress\ServerUtils\Server;

// Check server type
if ( Server::is_apache() ) {
	// Apache-specific code
}

if ( Server::is_nginx() ) {
	// Nginx-specific code
}

// Get server info
$info = Server::get_info();
// Returns: ['type' => 'Apache', 'software' => 'Apache/2.4.41']

// Check capabilities
if ( Server::supports_htaccess() ) {
	// Can use .htaccess files
}

if ( Server::has_mod_rewrite() ) {
	// mod_rewrite available
}
```

### Environment Detection

[](#environment-detection)

```
use ArrayPress\ServerUtils\Environment;

// Environment checks
if ( Environment::is_localhost() ) {
	// Local development
}

if ( Environment::is_staging() ) {
	// Staging environment
}

if ( Environment::is_production() ) {
	// Production environment
}

// Get environment type
$env = Environment::get_type(); // 'localhost', 'staging', 'production'

// Hosting platform detection
$platform = Environment::get_hosting_platform(); // 'WP Engine', 'Kinsta', etc.

// Container detection
if ( Environment::is_docker() ) {
	// Running in Docker
}
```

### PHP Configuration

[](#php-configuration)

```
use ArrayPress\ServerUtils\PHP;

// Version checks
if ( PHP::meets_version_requirement( '8.0' ) ) {
	// PHP 8.0+
}

// Extension checks
if ( PHP::has_extension( 'curl' ) ) {
	// cURL available
}

// Memory checks
if ( PHP::has_sufficient_memory( '256M' ) ) {
	// Enough memory
}

// Get values
$memory_limit  = PHP::get_memory_limit();
$max_execution = PHP::get_max_execution_time();
$upload_max    = PHP::get_upload_max_filesize();

// Function availability
if ( PHP::has_function( 'exec' ) ) {
	// exec() available and not disabled
}

// Use WordPress core functions for size conversion
$bytes    = wp_convert_hr_to_bytes( '256M' ); // WordPress core
$readable = size_format( 268435456 ); // WordPress core
```

### System Information

[](#system-information)

```
use ArrayPress\ServerUtils\System;

// OS detection
if ( System::is_linux() ) {
	// Linux-specific code
}

if ( System::is_windows() ) {
	// Windows-specific code
}

// Disk space
$disk = System::get_disk_space();
// Returns: ['total' => ..., 'free' => ..., 'used' => ..., 'percent' => ...]

if ( System::has_sufficient_disk_space( '1G' ) ) {
	// At least 1GB available
}

// System load (Unix systems)
$load = System::get_load_average(); // [1min, 5min, 15min]

if ( System::is_high_load( 2.0 ) ) {
	// Load above 2.0
}
```

What This Library Provides vs WordPress Core
--------------------------------------------

[](#what-this-library-provides-vs-wordpress-core)

**WordPress Core Has:**

- `is_ssl()` - SSL detection
- `wp_get_server_protocol()` - HTTP protocol
- `wp_is_mobile()` - Mobile detection
- `wp_is_json_request()` - JSON request detection
- `wp_convert_hr_to_bytes()` - Size string to bytes conversion
- `size_format()` - Bytes to human readable conversion

**This Library Adds:**

- Server type detection (Apache, Nginx, etc.)
- Environment detection (localhost, staging, production)
- Hosting platform identification
- PHP requirement validation
- Basic system information

Key Features
------------

[](#key-features)

- **Lean &amp; Focused**: Only essential server detection functionality
- **Plugin-Oriented**: Built for plugin developers' common needs
- **WordPress Compatible**: Works alongside core functions
- **Environment Aware**: Different behaviors for different environments
- **Zero Bloat**: No unnecessary features or complex monitoring

Requirements
------------

[](#requirements-1)

- PHP 7.4+
- WordPress 5.0+

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This project is licensed under the GPL-2.0-or-later License.

Support
-------

[](#support)

- [Documentation](https://github.com/arraypress/wp-server-utils)
- [Issue Tracker](https://github.com/arraypress/wp-server-utils/issues)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance47

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cd6eb8aff0903d87eb674d1ba3c5f3653899c0d7661504eb0deb7798ed86b643?d=identicon)[arraypress](/maintainers/arraypress)

---

Top Contributors

[![arraypress](https://avatars.githubusercontent.com/u/22668877?v=4)](https://github.com/arraypress "arraypress (3 commits)")

### Embed Badge

![Health badge](/badges/arraypress-wp-server-utils/health.svg)

```
[![Health](https://phpackages.com/badges/arraypress-wp-server-utils/health.svg)](https://phpackages.com/packages/arraypress-wp-server-utils)
```

###  Alternatives

[julien731/wp-review-me

A lightweight library to help you get more reviews for your WordPress theme/plugin

355.5k](/packages/julien731-wp-review-me)[plugowski/iptables

Class to manage entries in iptables.

131.6k](/packages/plugowski-iptables)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
