PHPackages                             objective-php/services-factory - 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. objective-php/services-factory

ActiveLibrary

objective-php/services-factory
==============================

Services container for Objective PHP

v3.1.0(6y ago)1125.8k↓29.5%5[1 PRs](https://github.com/objective-php/services-factory/pulls)13GPL-3.0PHPPHP &gt;=7.3

Since Aug 9Pushed 6y ago5 watchersCompare

[ Source](https://github.com/objective-php/services-factory)[ Packagist](https://packagist.org/packages/objective-php/services-factory)[ Docs](https://github.com/objective-php/services-factory)[ RSS](/packages/objective-php-services-factory/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (31)Used By (13)

Objective PHP / Services Factory [![Build Status](https://camo.githubusercontent.com/a544d56c0d04473accbb53cc0dae4786760c113e176670262a73404c42fba1b6/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6f626a6563746976652d7068702f73657276696365732d666163746f72792e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/objective-php/services-factory)
=======================================================================================================================================================================================================================================================================================================================================================================

[](#objective-php--services-factory-)

Description
-----------

[](#description)

Services Factory is an attempt to handle dependencies injection in an easier and more readable way compared to other available implementations.

The main main focus of this component is put on:

- reducing the code and configuration needed for DI mechanism
- preserving code-insight for components built and getting their dependencies injected

The Services Factory is split in several components. Understanding each of these helps a lot in understanding the whole logic of the component:

- Service Specifications
    - defined by ObjectivePHP\\ServicesFactory\\Specification\\ServiceSpecificationInterface
    - this how the service definitions are normalized, so that the Factory understands them
    - there are two default specs types provided with the component:
        - PrefabServiceSpecification
            - the most simple services ever!
            - stores a pre-instantiated object (or any other value)
        - ClassServiceSpecification
            - this one allow to define a class as template of a service
            - can get constructor arguments ("params" property)
            - optional dependencies can be set using setters ("setters" property)
            - **is autowired by default**
    - both types require an "id" parameter
    - the latter also supports a "static" property, to indicate whether the same instance should be returned each time the service is requested or not
- Service Builders
    - associated to the ServiceSpecs types, builders are in charge of actually building the service according to its specs
    - there also two builders bundled with the component, one for each type:
        - PrefabServiceBuilder
        - ClassServiceBuilder
- Factory
    - central object, it's used to register either service specs and builders
    - once setup, the Factory provide the application with services through its `get(string $serviceId)`method

### Documentation

[](#documentation)

The component documentation is located in the [docs](docs/index.md) subfolder

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 88.3% 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 ~54 days

Recently: every ~49 days

Total

30

Last Release

2343d ago

Major Versions

v0.9.0 → v1.0.0-beta12016-05-05

v1.2.6 → v2.0.22018-04-11

v2.1.1 → v3.0.02019-05-30

PHP version history (4 changes)v0.9.0PHP &gt;=5.6.0

v1.0.0-beta1PHP &gt;=7.0

v2.1.0PHP &gt;=7.1

v3.0.1PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/35ff61d55f3f648d8c1046aac3892fba4781067c98c5cf7e364767f8ca033166?d=identicon)[gauthier](/maintainers/gauthier)

---

Top Contributors

[![gauthier](https://avatars.githubusercontent.com/u/32955?v=4)](https://github.com/gauthier "gauthier (83 commits)")[![Neofox](https://avatars.githubusercontent.com/u/6177937?v=4)](https://github.com/Neofox "Neofox (10 commits)")[![fanshan](https://avatars.githubusercontent.com/u/1986015?v=4)](https://github.com/fanshan "fanshan (1 commits)")

---

Tags

dependency-injectionservicesobjective php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/objective-php-services-factory/health.svg)

```
[![Health](https://phpackages.com/badges/objective-php-services-factory/health.svg)](https://phpackages.com/packages/objective-php-services-factory)
```

###  Alternatives

[mouf/mouf

The Mouf PHP framework: an open-source PHP framework providing an easy way to download, install, use and reuse components, with a graphical user interface.

55146.0k17](/packages/mouf-mouf)[mouf/pimple-interop

This project is a very simple extension to the Pimple microframework. It adds to Pimple compatibility with the container-interop APIs.

102.4M2](/packages/mouf-pimple-interop)[mouf/picotainer

This package contains a really minimalist dependency injection container compatible with container-interop.

16189.8k11](/packages/mouf-picotainer)

PHPackages © 2026

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