PHPackages                             oktopost/skeleton - 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. oktopost/skeleton

ActiveLibrary

oktopost/skeleton
=================

Inversion of Control library

2.0.2(2y ago)04.0k—0%1[1 issues](https://github.com/Oktopost/Skeleton/issues)MITPHPPHP &gt;=8.1

Since Jul 7Pushed 2y ago13 watchersCompare

[ Source](https://github.com/Oktopost/Skeleton)[ Packagist](https://packagist.org/packages/oktopost/skeleton)[ Docs](https://github.com/Oktopost/Skeleton)[ RSS](/packages/oktopost-skeleton/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (25)Used By (0)

[![Build Status](https://camo.githubusercontent.com/2386ff3ad788ae2833c40a94ef5cfe810ef3f9fb9cb193e546a9f8681abc30d7/68747470733a2f2f7472617669732d63692e6f72672f4f6b746f706f73742f536b656c65746f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Oktopost/Skeleton)

Skeleton
========

[](#skeleton)

> Latest version 1.2.0

Skeleton is an [Inversion of Control (IoC)](https://en.wikipedia.org/wiki/Inversion_of_control) Library for PHP 7.1 or higher.

[![Build Status](https://camo.githubusercontent.com/2386ff3ad788ae2833c40a94ef5cfe810ef3f9fb9cb193e546a9f8681abc30d7/68747470733a2f2f7472617669732d63692e6f72672f4f6b746f706f73742f536b656c65746f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Oktopost/Skeleton)

- [Simple example project](https://github.com/Oktopost/Example-Skeleton)

Installation
------------

[](#installation)

```
composer require oktopost/skeleton
```

or inside *composer.json*

```
"require": {
    "oktopost/skeleton": "^1.0"
}
```

Basic Usage Example:
--------------------

[](#basic-usage-example)

```
// src/Proj/Base/IUserDAO.php
interface IUserDAO
{
    public function load($id);
}

// src/Proj/DAO/UserDAO.php
class UserDAO implements IUserDAO
{
    public function load($id)
    {
        // ...
    }
}

// skeleton-config.php
$skeleton = new \Skeleton\Skeleton();
$skeleton->set(Proj\Base\IUserDAO::class, Proj\DAO\UserDAO::class);
// or
$skeleton->set("Using any string as key", Proj\DAO\UserDAO::class);

// Obtaining a new instance using
$service = $skeleton->get(Proj\DAO\IUserDAO::class);
// or
$service = $skeleton->get("Using any string as key");
```

In this case, **$service** will be set to a new instance of the **UserDAO** class that was created by Skeleton.

Autoloading class
-----------------

[](#autoloading-class)

Given the following setup:

```
// src/Proj/Base/IUserDAO.php
interface IUserDAO {}

// src/Proj/Base/IUserService.php
interface IUserService {}

// src/Proj/DAO/UserDAO.php
class UserDAO implements IUserDAO {}

// skeleton-config.php
$skeleton = new \Skeleton\Skeleton();
$skeleton->set(Proj\Base\IUserDAO::class,     Proj\DAO\UserDAO::class);
$skeleton->set(Proj\Base\IUserService::class, Proj\Service\UserService::class);
```

Instance of **UserService** may be obtained *without* autoloading using:

```
// src/Proj/Service/UserService.php
class UserService implements IUserService
{
    public function setUserDAO(IUserDAO $dao)
    {
    }
}

$instance = $skeleton->get(IUserService::class);
$instance->setUserDAO($skeleton->get(IUserDAO::class));
```

But with autoloading you can omit the call to setUserDAO using one of the following.

### Using setter methods autolaoding

[](#using-setter-methods-autolaoding)

```
// skeleton-config.php
$skeleton->enableKnot();

// src/Proj/Service/UserService.php
/**
 * @autoload
 */
class UserService implements IUserService
{
    /**
     * @autoload
     * Method must start with the word "set", have only one parameter and the @autoload annotation.
     * Private and protected methods will be also autoloaded.
     */
    public function setUserDAO(IUserDAO $dao)
    {
    }
}

// example.php
$instance = $skeleton->get(IUserService::class);
```

### Using data member autoloading.

[](#using-data-member-autoloading)

```
// skeleton-config.php
$skeleton->enableKnot();

// src/Proj/Service/UserService.php
/**
 * @autoload
 */
class UserService implements IUserService
{
    /**
     * @autoload
     * @var \Full\Path\To\IUserDAO
     * Important: Full path must be defined under the @var annotation.
     */
    private $dao;
}

// example.php
$instance = $skeleton->get(IUserService::class);
```

### Using \_\_construct autoloading.

[](#using-__construct-autoloading)

In this case the *autoload* annotation is not required for the class name nor for the \_\_construct method.

```
// skeleton-config.php
$skeleton->enableKnot();

// src/Proj/Service/UserService.php
class UserService implements IUserService
{
    public function __construct(IUserDAO $dao)
    {
    }
}

// example.php
$instance = $skeleton->get(IUserService::class);
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 84.1% 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 ~114 days

Recently: every ~353 days

Total

23

Last Release

1071d ago

Major Versions

1.3.0 → 2.0.02022-05-08

PHP version history (4 changes)1.0.0PHP &gt;=5.5

1.0.10PHP &gt;=7.1

1.3.0PHP &gt;=7.4

2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/20dd11f9cfc13b0c4521787a143ea9ae3990e0458d712273fdf6c8a3529ca5d0?d=identicon)[alexey-pkv](/maintainers/alexey-pkv)

---

Top Contributors

[![alexey-pkv](https://avatars.githubusercontent.com/u/11766594?v=4)](https://github.com/alexey-pkv "alexey-pkv (53 commits)")[![ceres66](https://avatars.githubusercontent.com/u/16320669?v=4)](https://github.com/ceres66 "ceres66 (4 commits)")[![grohman](https://avatars.githubusercontent.com/u/1030260?v=4)](https://github.com/grohman "grohman (4 commits)")[![ivan-demchenkov](https://avatars.githubusercontent.com/u/7835992?v=4)](https://github.com/ivan-demchenkov "ivan-demchenkov (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oktopost-skeleton/health.svg)

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

PHPackages © 2026

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