Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.
/ Shedinja Public archive

An easy-to-use and flexible dependency injection library for Kotlin.

License

Notifications You must be signed in to change notification settings

utybo/Shedinja

Repository files navigation

SHEDINJA IS DEPRECATED

Shedinja has been moved to the Tegral project under the name "Tegral DI". See here for more information on Tegral DI.

This repository is no longer maintained as a result.

Previous README below.

.

.

.

Shedinja Shedinja

Documentation Packages MIT license GitHub Workflow Status Codecov

Inspired by Koin, Shedinja is a simple, safe and easy-to-use dependency injection library with extremely flexible internals.

⚡ This framework is experimental and under heavy development. As such, it should not be considered stable and should not be used in production environments.

Getting Started

Using Shedinja is simple:

  • Add a scope: InjectionScope parameter to your class.
    • This is only required if you would like to inject components into your class. If your class does not require injection, such a parameter is not necessary.
  • Define your injectable elements, either one-by-one or grouped in modules.
  • Create an environment.
  • Profit!
class Repository {
    // ...
}

class Service(scope: InjectionScope) {
    private val repo: Repository by scope()
    // ...
}

data class Configuration(val someUrl: String)

val appModule = module {
    put(::Repository)
    put(::Service)
    put { Configuration("https://example.com") }
}

val env = shedinja { put(appModule) }