PHPackages                             yggverse/nps - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. yggverse/nps

AbandonedArchivedLibrary[DevOps &amp; Deployment](/categories/devops)

yggverse/nps
============

PHP 8 Library for NPS Protocol

1.3.1(2y ago)010MITPHP

Since Apr 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/YGGverse/nps-php)[ Packagist](https://packagist.org/packages/yggverse/nps)[ Docs](https://github.com/yggverse/nps-php)[ RSS](/packages/yggverse-nps/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

**Archived!**

Use [Ratchet](https://github.com/ratchetphp/Ratchet) `IoServer` - asynchronous WebSocket in PHP as more featured replacement to this library.

nps-php
=======

[](#nps-php)

PHP 8 / Composer Library for NPS Protocol

Like Titan for Gemini, NPS is the satellite for NEX protocol (see also [nex-php](https://github.com/YGGverse/nex-php))
it listen for single dot in line to signal the package ending.

Specification
-------------

[](#specification)

`nex://nightfall.city/nps/`

Usage
-----

[](#usage)

```
composer require yggverse/nps

```

Server
------

[](#server)

Build interactive server instance to listen NPS protocol connections!

```
$server = new \Yggverse\Nps\Server;
```

Provide optional `host`, `port`, `size`, `line` and `live` arguments in constructor:

```
$server = new \Yggverse\Nps\Server('127.0.0.1', 1915);
```

Alternatively, use following setters after object initiation

#### Server::setHost

[](#serversethost)

Bind server host to listen incoming connections, `127.0.0.1` by default

#### Server::getHost

[](#servergethost)

Get current server host

#### Server::setPort

[](#serversetport)

Bind server port to listen incoming connections, `1915` by default

#### Server::getPort

[](#servergetport)

Get current server port

#### Server::setSize

[](#serversetsize)

Set total content length limit by [mb\_strlen](https://www.php.net/manual/en/function.mb-strlen.php), `0` by default (unlimited)

#### Server::getSize

[](#servergetsize)

Get current content length limit

#### Server::setLine

[](#serversetline)

Set packet line limit in bytes passing to [fread](https://www.php.net/manual/en/function.fread.php#length), `1024` by default

#### Server::getLine

[](#servergetline)

Get current packet line limit

#### Server::setLive

[](#serversetlive)

Set server status `true`|`false` to shutdown immediately

#### Server::getLive

[](#servergetlive)

Get current server status

#### Server::setWelcome

[](#serversetwelcome)

Define application logic on peer connection established

```
$server->setWelcome(
    function (
        string $connect
    ): ?string
    {
        printf(
            "connected: %s\n\r",
            $connect
        );

        return sprintf(
            "welcome, %s\n\r",
            $connect
        );
    }
);
```

#### Server::getWelcome

[](#servergetwelcome)

Get current `Welcome` function, `null` by default

#### Server::setPending

[](#serversetpending)

Define application logic on peer make initial request

```
$server->setPending(
    function (
        string $request,
        string $connect
    ): ?string
    {
        printf(
            'connection: %s requested: %s',
            $connect,
            $request,
        );

        return sprintf(
            'received: %s',
            $request
        );
    }
);
```

#### Server::getPending

[](#servergetpending)

Get current `Pending` function, `null` by default

#### Server::setHandler

[](#serversethandler)

Define basic application logic on complete packet received

- could be also defined as [Server::start](https://github.com/YGGverse/nps-php#serverstart) argument

```
$server->setHandler(
    function (
          bool $success,
        string $content,
        string $request,
        string $connect
    ): ?string
    {
        printf(
            'connection: %s request: %s',
            $connect,
            $request
        );

        if ($success)
        {
            var_dump(
                $content
            );
        }

        return 'thank you!';
    }
);
```

#### Server::getHandler

[](#servergethandler)

Get current `Handler` function, `null` by default

#### Server::start

[](#serverstart)

Run server object

```
$server->start();
```

Optionally, define handler function as the argument to process application logic dependent of client request

```
$server->start(
    function (
          bool $success,
        string $content,
        string $request,
        string $connect
    ): ?string
    {
        printf(
            'connection: %s request: %s',
            $connect,
            $request
        );

        if ($success)
        {
            var_dump(
                $content
            );
        }

        return 'thank you!'; // null|string response
    }
);
```

#### Server::stop

[](#serverstop)

Stop server instance.

Same to `Server::setLive(false)`

### Testing

[](#testing)

1. `nc 127.0.0.1 1915` - connect server using `nc`
2. `test` - enter the target path
3. `YOUR MESSAGE GOES HERE` - enter the message text
4. `.` - commit package with dot

To send any file:

```
test
╦ ╦╔═╗╔═╗╔╦╗╦═╗╔═╗╔═╗╦╦
╚╦╝║ ╦║ ╦ ║║╠╦╝╠═╣╚═╗║║
 ╩ ╚═╝╚═╝═╩╝╩╚═╩ ╩╚═╝╩╩═╝
.
```

`cat file.txt | nc 127.0.0.1 1915`

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

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 ~1 days

Total

5

Last Release

795d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/108541346?v=4)[d47081](/maintainers/d47081)[@d47081](https://github.com/d47081)

![](https://avatars.githubusercontent.com/u/129769985?v=4)[YGGverse](/maintainers/YGGverse)[@YGGverse](https://github.com/YGGverse)

---

Top Contributors

[![d47081](https://avatars.githubusercontent.com/u/108541346?v=4)](https://github.com/d47081 "d47081 (1 commits)")

---

Tags

1915composerncnexnex-protocolnpsnps-librarynps-phpnps-protocolnps-protocol-librarynps-protocol-servernps-serverserversmallwebtelnettinywebserverNPSyggversenps-protocol

### Embed Badge

![Health badge](/badges/yggverse-nps/health.svg)

```
[![Health](https://phpackages.com/badges/yggverse-nps/health.svg)](https://phpackages.com/packages/yggverse-nps)
```

###  Alternatives

[spatie/laravel-webhook-server

Send webhooks in Laravel apps

1.1k10.1M29](/packages/spatie-laravel-webhook-server)[felixfbecker/language-server-protocol

PHP classes for the Language Server Protocol

22581.4M5](/packages/felixfbecker-language-server-protocol)[clue/socket-raw

Simple and lightweight OOP wrapper for PHP's low-level sockets extension (ext-sockets).

35312.1M50](/packages/clue-socket-raw)[voryx/thruway

Thruway WAMP router core

6751.0M17](/packages/voryx-thruway)[php-mcp/server

PHP SDK for building Model Context Protocol (MCP) servers - Create MCP tools, resources, and prompts

850577.8k55](/packages/php-mcp-server)[laminas/laminas-server

Create Reflection-based RPC servers

2425.0M28](/packages/laminas-laminas-server)

PHPackages © 2026

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