PHPackages                             lx/sigen - 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. lx/sigen

AbandonedArchivedLibrary

lx/sigen
========

Service Interface Generator

0.1(12y ago)025MITPHPPHP &gt;=5.3.0

Since Dec 13Pushed 12y ago1 watchersCompare

[ Source](https://github.com/l-x/SIGen)[ Packagist](https://packagist.org/packages/lx/sigen)[ Docs](https://boolshit.de)[ RSS](/packages/lx-sigen/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

SIGen - Service Interface Generator
===================================

[](#sigen---service-interface-generator)

While working on the webservices api of an enterprise PHP application I've ran into the following problem:

If registering a class or class instance to PHP's SoapServer, all public methods will be exposed to the API. This also affects Zend Framework's components which use PHP's reflection api.

I needed the ability to control the methods' visibility to the server component at runtime.

Imagine the following base class for handling different resources:

```
abstract BaseResource {

    abstract public function getResourceHandler();

    /**
     * Deletes the resource with the given id
     *
     * @param int $id Resource id
     */
    public function delete($id) {
        $resource_handler = $this->getResourceHandler();
        if(!$resource_handler->mayBeDeleted()) {
            throw new \Exception('Resource of type '.$resource_handler->getTypeDescription().' may not be deleted';
        }
        if(!$this->getCurrentUser()->mayDelete($resource_handler) {
            throw new \Exception('You are not allowed to delete this resource';
        }

        return $resource_handler->deleteById($id);
    }
}

```

A child class could look like this:

```
class ImageResource {
    public function getResourceHandler() {
        return new ImageResourceHandler();
    }
}

```

If registering ImageResource to the SoapServer, all public methods will be exposed, even if the resource type i. e. disallows the deletion of this type's resources in general.

With SIGen one could rewrite the BaseResource as follows:

```
abstract BaseResource {

    abstract public function getResourceHandler();

    /**
     * Deletes the ##$resource_handler->getResourceDescription()## with the given id
     *
     * @expose ##$resource_handler->mayBeDeleted() && $current_user->mayDelete($resource_handler)##
     * @param int $id ##$resource_handler->getResourceDescription()## id
     */
    public function delete($id) {
        return $this->getResourceHandler()->deleteById($id);
    }
}

```

You now will not register the class itself to the soap server, but a class proxy ($proxy\_object) which will be generated on the fly:

```
$service_object = new ImageResource();
$interface_builder = new \SIGen\InterfaceBuilder(array('resource_handler' => $service_object->getResourceHandler(), 'current_user' => $service_object->getCurrentUser()));
$proxy_object = $interface_builder->generateInstance($service_object);

```

$proxy\_object will contain the method 'delete' only, if the expression `@expose ####` will return true. Also the docblock's short description will change to a less generic one.

---

[![Build Status](https://camo.githubusercontent.com/be2de87f37f8f56ef03b510697e573dd7e53fde8f91c2e020f5a2531a82c1275/68747470733a2f2f7472617669732d63692e6f72672f6c2d782f466e612e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/l-x/Fna)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

4535d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/72e411d9ecb8a47babd6429b88147bbafbd43e18c48916ee2d38e83af8becaa0?d=identicon)[lx](/maintainers/lx)

---

Tags

generatorclassmeta programming

### Embed Badge

![Health badge](/badges/lx-sigen/health.svg)

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

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k27.6M92](/packages/simplesoftwareio-simple-qrcode)[nette/robot-loader

🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.

89152.7M321](/packages/nette-robot-loader)[phpowermove/docblock

PHP Docblock parser and generator. An API to read and write Docblocks.

2524.0M4](/packages/phpowermove-docblock)

PHPackages © 2026

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