PHPackages                             codelego/phpfox-service - 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. [Framework](/categories/framework)
4. /
5. codelego/phpfox-service

ActiveLibrary[Framework](/categories/framework)

codelego/phpfox-service
=======================

Service library for phpfox framework.

0171PHP

Since Nov 29Pushed 9y ago1 watchersCompare

[ Source](https://github.com/codelego/phpfox-service)[ Packagist](https://packagist.org/packages/codelego/phpfox-service)[ RSS](/packages/codelego-phpfox-service/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

phpfox-service
==============

[](#phpfox-service)

> This library does not support service locator pattern.
> All service must be declare in configure explicit.

Service manager is a container which control the way to create an object using their name instead of create them explicit.

There are 4 methods in the container

- has($id): bool
- get($id): mixed
- set($id, $object)
- build($id): mixed
- remove($id): void

In other to configure an object, declare them in `module.config.php`.

```
return [
    'services'=>[
        'map'=>[
            'db'=> [null, ServiceClass],
            'db2'=> [ServiceFactoryClass,],
        ]
    ]
]
```

```
```

We support 2 way of $scheme value:

- If the first value is null, the constructor of `ServiceClass` will be called.
- If the first value is a string, It must implement `FactoryInterface`, so the factory pattern will be used.

Example

`module.config.php`

```
return [
    'services'=>[
        'map'=>[
            'models'=>[null, 'Phpfox\Model\GatewayManager'],
            'other_service'=> [OtherServiceFactory,]
        ]
    ]
]

class OtherServiceFactory {
    function factory($className){
        return new ExampleService();
    }
}
```

Use class name directly

```
$models  =  $service->get('models');
echo get_class($models);
//print "Phpfox\Model\GatewayManager"
```

Use factory class name

```
$others  =  $service->get('other_service');
echo get_class($others);
//print "ExampleService"
```

Service Manager is a container, when you call `get($id)`

- If the first call, they build a service map to $id, then store in their container.
- Call `get($id)` again, it return the object in its container.
- If you want to create a new instance of $id, call `build($id)` instead.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.6% 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.

### Community

Maintainers

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

---

Top Contributors

[![codelego](https://avatars.githubusercontent.com/u/171187?v=4)](https://github.com/codelego "codelego (22 commits)")[![jacky0482](https://avatars.githubusercontent.com/u/57336869?v=4)](https://github.com/jacky0482 "jacky0482 (4 commits)")

### Embed Badge

![Health badge](/badges/codelego-phpfox-service/health.svg)

```
[![Health](https://phpackages.com/badges/codelego-phpfox-service/health.svg)](https://phpackages.com/packages/codelego-phpfox-service)
```

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k39.6M293](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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