PHPackages                             meta-tech/pws-server - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. meta-tech/pws-server

ActiveLibrary[HTTP &amp; Networking](/categories/http)

meta-tech/pws-server
====================

PwsServer is a web application skeleton in silex2 managing web services through PwsAuth protocol

1.0.2(9y ago)012MITPHP

Since Mar 15Pushed 9y ago1 watchersCompare

[ Source](https://github.com/meta-tech/pws-server)[ Packagist](https://packagist.org/packages/meta-tech/pws-server)[ Docs](https://github.com/meta-tech/pws-server)[ RSS](/packages/meta-tech-pws-server/feed)WikiDiscussions master Synced 2d ago

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

MetaTech PwsServer
==================

[](#metatech-pwsserver)

PwsServer is a web application skeleton in silex2 managing web services through PwsAuth protocol

### Requirements

[](#requirements)

- PHP 7.0
- meta-tech/silex 2
- meta-tech/silex-core
- meta-tech/pws-client (to test ws)

### Install

[](#install)

The package can be installed using [ Composer ](https://getcomposer.org/).

```
composer require meta-tech/pws-server

```

Or add the package to your `composer.json`.

```
"require": {
    "meta-tech/pws-server" : "^1.0"
}

```

### Usage

[](#usage)

see [ MetaTech\\Silex\\Provider\\ControllerServiceProvider ](https://github.com/meta-tech/silex-controller-service)to managing controllers &amp; routing in application

```
namespace MetaTech\PwsServer;

use MetaTech\Silex\Application as App;
use MetaTech\Silex\Provider\ControllerServiceProvider as CtrlProvider;
use MetaTech\Silex\Provider\UserProvider;
use MetaTech\Db\PdoWrapper;
use MetaTech\Db\Profile;
use MetaTech\PwsAuth\Authenticator;
use MetaTech\PwsServer\Ctrl\Test;
use MetaTech\PwsServer\Ctrl\WebService;
use MetaTech\PwsServer\Ctrl\OtherWebService;

class Application extends App
{
    protected function setServices()
    {
        $app = $this;
        $app['ws.authenticator'] = function ($app) {
            return new Authenticator($app['config']['pwsauth']);
        };
        $app['pdo'] = function ($app) {
            return new PdoWrapper(new Profile($app['config']['db']['default']));
        };
        $app['user.provider'] = function ($app) {
            return new UserProvider($app['pdo']);
        };
    }

    protected function routingDefinition()
    {
        $this->register(new CtrlProvider(Test::class           , [$this], '/'));
        $this->register(new CtrlProvider(WebService::class     , [$this], '/ws'));
        $this->register(new CtrlProvider(OtherWebService::class, [$this], '/ws/deep'));
    }
}
```

Controller example :

```
use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request;
use MetaTech\PwsServer\Ws\Controller;

class WebService extends Controller
{
    public function index(Request $request)
    {
        $done = true;
        $msg  = 'this is index';
        return $this->response($done, $msg);
    }

    public function routing(ControllerCollection $collection) : ControllerCollection
    {
        $collection = parent::routing($collection);
        $_          = $this->ns();

        $collection->match('/', "$_:index");

        return $collection;
    }
}
```

`pwsAuth` Authentication mecanism is already provided by the `MetaTech\Silex\Ws\Controller` parent class &amp; the `MetaTech\Silex\Ws\Authentication` handler (in [ meta-tech/silex-core](https://github.com/meta-tech/silex-core) package)

Check `OtherWebService` to see another controller and deep routes inside rooting /ws entry point. The main différence consist in no calling the parent routing method, however the pwsauth authentication still be active.

The project now implement the `checkUser` method via a `userProvider`
It use a `MetaTech\Silex\Ws\Authentication` and `MetaTech\Silex\Ws\Controller` subclasses :

```
namespace MetaTech\PwsServer\Ws;

use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
use MetaTech\PwsAuth\Authenticator;
use MetaTech\Silex\Ws\Authentication as BaseAuthentication;
use MetaTech\Silex\Provider\UserProvider;

class Authentication extends BaseAuthentication
{
    protected $userProvider;

    public function __construct(Session $session, Authenticator $authenticator, PasswordEncoderInterface $passEncoder = null, UserProvider $userProvider)
    {
        parent::__construct($session, $authenticator, $passEncoder);
        $this->userProvider = $userProvider;
    }

    public function checkUser($login, $password, $key, PasswordEncoderInterface $passEncoder = null)
    {
        $done = false;
        try {
            if (!is_null($passEncoder)) {
                $user = $this->userProvider->loadUserByUsername($login);
                $salt = $this->authenticator->getUserSalt($login);
                $done = $user->key == $key && $passEncoder->encodePassword($password, $salt) == $user->getPassword();
            }
        }
        catch(\Exception $e) {
            //~ var_dump($e->getTraceAsString());
        }
        return $done;
    }
}
```

the controller :

```
namespace MetaTech\PwsServer\Ws;

use Silex\Application;
use MetaTech\Silex\Ws\Controller as BaseController;
use MetaTech\PwsServer\Ws\Authentication;

class Controller extends BaseController
{
    public function __construct(Application $app = null)
    {
        $this->session = $app['session'];
        $this->handler = new Authentication($this->session, $app['ws.authenticator'], $app['security.encoder.pbkdf2'], $app['user.provider']);
    }
}
```

### Test uris :

[](#test-uris-)

access through web browser :

- servername/
- servername/test

access through pws-client :

- servername/ws
- servername/ws/deep
- servername/ws/isauth

### License

[](#license)

The project is released under the MIT license, see the LICENSE file.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Total

3

Last Release

3390d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26345971?v=4)[meta-tech.academy](/maintainers/Meta-Tech)[@meta-tech](https://github.com/meta-tech)

---

Top Contributors

[![a-sansara](https://avatars.githubusercontent.com/u/16254357?v=4)](https://github.com/a-sansara "a-sansara (13 commits)")

---

Tags

phppwsauthsilex2webservicehttpserversilexwebservicePwsAuth

### Embed Badge

![Health badge](/badges/meta-tech-pws-server/health.svg)

```
[![Health](https://phpackages.com/badges/meta-tech-pws-server/health.svg)](https://phpackages.com/packages/meta-tech-pws-server)
```

###  Alternatives

[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78127.7M461](/packages/react-http)[amphp/http-server

A non-blocking HTTP application server for PHP based on Amp.

1.3k6.7M106](/packages/amphp-http-server)[hhxsv5/laravel-s

🚀 LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.

3.9k691.5k13](/packages/hhxsv5-laravel-s)[swow/swow

Coroutine-based multi-platform support engine with a focus on concurrent I/O

1.3k2.2M88](/packages/swow-swow)[psr/http-server-handler

Common interface for HTTP server-side request handler

180114.7M1.2k](/packages/psr-http-server-handler)[amphp/websocket-server

Websocket server for Amp's HTTP server.

125282.8k27](/packages/amphp-websocket-server)

PHPackages © 2026

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