PHPackages                             lfischer/internet-available - 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. lfischer/internet-available

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

lfischer/internet-available
===========================

A small component to check if the internet is currently available / accessible

1.0.1(6y ago)063MITPHPPHP &gt;=7.1CI failing

Since Jan 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/leonardfischer/internet-check)[ Packagist](https://packagist.org/packages/lfischer/internet-available)[ RSS](/packages/lfischer-internet-available/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

Internet check
==============

[](#internet-check)

A small component to check if the internet is accessible. Original idea by [Stackoverflow #4860365](http://stackoverflow.com/questions/4860365/determine-in-php-script-if-connected-to-internet). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Usage
=====

[](#usage)

The very basic usage (with default parameters) looks like this:

```
$available = \lfischer\internet\Internet::available();
```

But of course there are some options you can provide to handle the responses as you need them:

```
use \lfischer\internet\Internet;
use \lfischer\internet\InternetException;
use \lfischer\internet\InternetProblemException;

// Check the availability by connecting to Google on port 80.
$available = (new Internet('www.google.com', 80))->check();

//
try {
    $internet = new Internet(
        'www.google.com',
        80,
        Internet::EXCEPTION_ON_UNAVAILABILITY + Internet::PROBLEM_AS_EXCEPTION
    );

    $available = $internet->check();
} catch (InternetException $e) {
    // The internet is not available.
    $internet->getErrorString();
    $internet->getErrorNumber();
    $e->getMessage();
} catch (InternetProblemException $e) {
    // There was a problem while checking the availability.
     $internet->getErrorString();
     $internet->getErrorNumber();
     $e->getMessage();
 }
```

Options
-------

[](#options)

You can pass some options to change the behaviour in case of problems.

- `Internet::EXCEPTION_ON_UNAVAILABILITY`
    Will throw an `InternetException` exception if the internet is unavailable (instead of returning `false`).
- `Internet::PROBLEM_AS_EXCEPTION`
    Will throw an `InternetProblemException` exception if the internet availability could not be checked due to a problem (instead of returning `false`).
- `Internet::PROBLEM_AS_TRUE`
    Will return `true` in case of a problem during the availability check since you'd like to assume something else went wrong.

Static code analysis and code style
===================================

[](#static-code-analysis-and-code-style)

The code is being statically analyzed with the help of [vimeo/psalm](https://packagist.org/packages/vimeo/psalm). The PSR2 code style will be checked/applied with the help of [friendsofphp/php-cs-fixer](https://packagist.org/packages/friendsofphp/php-cs-fixer).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~2 days

Total

2

Last Release

2307d ago

PHP version history (2 changes)1.0PHP &gt;7.1

1.0.1PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/316a942d2a9c90eab5c2ba18e9886d5e7d8af7b5c6fe850fe96085dfd08f3486?d=identicon)[Leonard Fischer](/maintainers/Leonard%20Fischer)

---

Top Contributors

[![leonardfischer](https://avatars.githubusercontent.com/u/399835?v=4)](https://github.com/leonardfischer "leonardfischer (6 commits)")

###  Code Quality

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lfischer-internet-available/health.svg)

```
[![Health](https://phpackages.com/badges/lfischer-internet-available/health.svg)](https://phpackages.com/packages/lfischer-internet-available)
```

###  Alternatives

[ecotone/ecotone

Supporting you in building DDD, CQRS, Event Sourcing applications with ease.

558549.8k17](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[j0k3r/php-readability

Automatic article extraction from HTML

186808.8k6](/packages/j0k3r-php-readability)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)[symfony/ai-agent

PHP library for building agentic applications.

30536.7k44](/packages/symfony-ai-agent)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)

PHPackages © 2026

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