Kodein
Painless Kotlin Dependency Injection (by kosi-libs)
kotlin-inject
Dependency injection lib for kotlin (by evant)
Our great sponsors
Kodein | kotlin-inject | |
---|---|---|
3 | 9 | |
3,129 | 1,077 | |
0.4% | - | |
6.0 | 8.0 | |
17 days ago | 7 days ago | |
Kotlin | Kotlin | |
MIT License | Apache License 2.0 |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Kodein
Posts with mentions or reviews of Kodein.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-11-09.
-
Kodein VS MocKMP - a user suggested alternative
2 projects | 9 Nov 2022
-
Do we really need to use Dependency Injection Framework?
Now I will finish up saying Hilt is just an opinionated way to dependency injection on Android, but there are simpler frameworks out there such as Koin or Kodein that can help take away a lot of the troubles that can come when you try to make your own framework. Just know that most other frameworks tend to be runtime injection instead of compile time injection like Hilt, which can be helpful to know at compile time if you are missing a dependency in your graph as opposed to runtime when its out in the wild.
-
Yet another DI library, bit this time it's not a service locator
Long answer: My pain mostly comes from using [Kodein](https://github.com/Kodein-Framework/Kodein-DI/) and a custom service locator in an iOS/Swift project. Other than that I have very little experience with DI (e.g. I never used Dagger so far), so my opinion might be a little biased. Also, both of these projects are really large, so, in many cases, a class is declared in one module but used in a completely different module and the DI or service locator is sort of the glue between the modules.
kotlin-inject
Posts with mentions or reviews of kotlin-inject.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-09-02.
-
From Dagger & Hilt into the multiplatform world with kotlin-inject
Depending on how you use Anvil, there are definitely things that are missing/not as straightforward, e.g. https://github.com/evant/kotlin-inject/issues/212
-
What happened to the Koin hype?
I haven't used koin in a couple years since my newer jobs are using hilt and dagger/anvil for the compile time safety. In my personal projects I have been using kmp which when I started two years ago, koin was in alpha which was why I decided to use kodein. Which koin is stable in kmp, although kotlin-inject seems like a promising kmp compile time di in place of dagger.
- Alternative to Hilt for KMM but not Koin
-
Multiplatform dependency injection libraries equivalent to Dagger/Anvil
I would suggest looking at Kotlin-Inject, it's a compile-time DI like Dagger and it's really pleasant to use.
- Nine circles of hell to migrate a Kotlin Multiplatform project to the koin-annotations
-
Is there extra benefits of using Koin instead of Dagger Hilt in KMM?
Dagger/ hilt will not work on kmm being that they are java projects. One project that is similar to them though on kmm is kotlin-inject which might be something to look at.
-
Yet another DI for kotlin multiplatform
I'd say it's second after this one. That one has multiplatform support in snapshot version, while mine is in alpha)
-
Yet another DI library, bit this time it's not a service locator
Interesting! Author of kotlin-inject here, I had originally looked at writing a compiler plugin and using IR but the lack of documentation and a non-stable api scared me away. Cool that you were able to get it to work.
What are some alternatives?
When comparing Kodein and kotlin-inject you can also consider the following projects:
koin - Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
kotlin-guice - Guice DSL extensions for Kotlin
anvil - A Kotlin compiler plugin to make dependency injection with Dagger 2 easier.
injekt
dikt - Simple and powerful DI for kotlin multiplatform
kapsule - Minimalist dependency injection library for Kotlin.
Dagger2 - A fast dependency injector for Android and Java.
KODI - light-weight KOtlin Dependency Injection (KODI)
motif - A simple DI API for Android / Java
kotlin-guiced - Convenience Kotlin API over the Google Guice DI Library
ksp - Kotlin Symbol Processing API