PHPackages                             prospress/hosts-helper - 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. prospress/hosts-helper

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

prospress/hosts-helper
======================

Helper classes for dealing with particular hosting providers.

v1.0.2(7y ago)08MITPHPPHP ^5.3 || ^7.0

Since Oct 9Pushed 2y ago3 watchersCompare

[ Source](https://github.com/Prospress/hosts-helper)[ Packagist](https://packagist.org/packages/prospress/hosts-helper)[ RSS](/packages/prospress-hosts-helper/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (4)Used By (0)

> IMPORTANT: This code is made available in the hope that it will be useful, but **without any warranty**. See the GNU General Public License included with the code for more details. Automattic or WooCommerce support services are also not available to assist with the use of this code.

Prospress Hosts Helper
======================

[](#prospress-hosts-helper)

This library provides an easy interface to identify certain known characteristics of managed WP hosts.

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

[](#requirements)

This library requires **PHP 5.3+** due to the usage of namespaces.

Recognized Hosts
----------------

[](#recognized-hosts)

There are currently 4 recognized hosting environments:

1. [Pantheon](https://pantheon.io)
2. [SiteGround](https://www.siteground.com)
3. [WP Engine](https://wpengine.com)
4. All other hosts

***Note:** Prospress does not endorse any particular hosting provider.*

Autoloading
-----------

[](#autoloading)

### Composer Autoloader

[](#composer-autoloader)

Before making use of this library, you'll need to initialize [Composer](https://getcomposer.org):

```
composer install
```

Your code can then `require` the `vendor/autoloader.php` file to autoload the classes used within this library.

### Custom Autoloader

[](#custom-autoloader)

If you'd prefer not to use Composer for any reason, you can make use of a custom [PSR-4 Autoloader](https://www.php-fig.org/psr/psr-4/). You can write your own, or use an existing one. A good option for an existing autoloader is the one implemented in [WP CLI](https://github.com/wp-cli/wp-cli/blob/master/php/WP_CLI/Autoloader.php). You will then need to register the `Prospress\Hosts` namespace with this library's `src/` directory.

Usage
-----

[](#usage)

To get a class implementation that provides information about the current host, you should use the `Prospress\Hosts\Helper::getHost()` method. This will provide you with a class instance based on the detected hosting environment.

There are currently 2 uses of this library:

1. Determine the script timeout of the current environment.
2. Determine whether database queries of a certain character length are killed. If they are killed, there are methods available for unhooking and re-hooking the killing functionality.

### Script Timeout

[](#script-timeout)

To get the script timeout for the current host, you can make use of the `getTimeout()` method:

```
