GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - NickButcher1/koin: KOIN - a pragmatic lightweight dependency injection framework for Kotlin

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

1,261 Commits
1,261 Commits

Folders and files

NameName
Last commit message
Last commit date
.circleci
.circleci
 
 
.github/ISSUE_TEMPLATE
.github/ISSUE_TEMPLATE
 
 
img
img
 
 
koin-projects
koin-projects
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.adoc
CONTRIBUTING.adoc
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

logo

What is KOIN?

A pragmatic lightweight dependency injection framework for Kotlin developers.

Written in pure Kotlin, using functional resolution only: no proxy, no code generation, no reflection.

Koin is a DSL, a light container and a pragmatic API

Official Website πŸ‘‰ https://insert-koin.io

Koin 2.0 is out: https://medium.com/koin-developers/ready-for-koin-2-0-2722ab59cac3

Contact & Latest News 🌐

  • Follow us on Twitter for latest news: @insertkoin_io
  • Koin developers on Medium: koin developers hub

Getting Help πŸš’

Any question about Koin usage?

  • Come talk on slack #koin channel
  • Post your question on Stackoverflow - #koin tag

Reporting issues πŸ› 

Found a bug or a problem on a specific feature? Open an issue on Github issues

Koin 1.0 docs - https://old.insert-koin.io

Setup

Current Version

// latest stable
koin_version = '2.0.1'

Gradle

Jcenter

Check that you have the jcenter repository.

// Add Jcenter to your repositories if needed
repositories {
	jcenter()    
}

Dependencies

Pick one of your Koin dependency:

Core features

// Koin for Kotlin
implementation "org.koin:koin-core:$koin_version"
// Koin extended & experimental features
implementation "org.koin:koin-core-ext:$koin_version"
// Koin for Unit tests
testImplementation "org.koin:koin-test:$koin_version"
// Koin for Java developers
implementation "org.koin:koin-java:$koin_version"

Android

// Koin for Android
implementation "org.koin:koin-android:$koin_version"
// Koin Android Scope features
implementation "org.koin:koin-android-scope:$koin_version"
// Koin Android ViewModel features
implementation "org.koin:koin-android-viewmodel:$koin_version"
// Koin Android Experimental features
implementation "org.koin:koin-android-ext:$koin_version"

AndroidX

// Koin AndroidX Scope features
implementation "org.koin:koin-android-scope:$koin_version"
// Koin AndroidX ViewModel features
implementation "org.koin:koin-android-viewmodel:$koin_version"
// Koin AndroidX Experimental features
implementation "org.koin:koin-android-ext:$koin_version"

Ktor

// Koin for Ktor Kotlin
implementation "org.koin:koin-ktor:$koin_version"

Quickstart

Declare a Koin module

Write with the Koin DSL what you need to assemble:

// Given some classes 
class Controller(val service : BusinessService) 
class BusinessService() 

// just declare it 
val myModule = module { 
  single { Controller(get()) } 
  single { BusinessService() } 
} 

Starting Koin

Use the startKoin() function to start Koin in your application.

In a Kotlin app:

fun main(vararg args : String) { 
  // start Koin!
  startKoin {
    // your modules
    modules(myModule)
  }
} 

In an Android app:

class MyApplication : Application() {
  override fun onCreate(){
    super.onCreate()
    // start Koin!
    startKoin {
      // Android context
      androidContext(this@MyApplication)
      // modules
      modules(myModule)
    }
  } 
} 
  • Write your app with Koin
  • Quick References

Articles

Articles & resouces about Koin

  • Ready for Koin 2.0
  • Migration from Dagger2 to Koin
  • From Dagger to Koin, a step by step migration guide
  • Koin in Feature Modules Project
  • A brief look at Koin on Android
  • Bye bye Dagger
  • Testing with Koin
  • Painless Android testing with Room & Koin
  • Unlock your Android ViewModel power with Koin
  • Using dependency injection with Koin
  • Koin + Spark = ❀️
  • Push SparkJava to the next level (Kotlin Weekly issue 73, DZone.com )
  • When Koin met Ktor ... (Kotlin Weekly issue 72)
  • Android Dependency Injection – Why we moved from Dagger 2 to Koin?
  • Moving from Dagger to Koin - Simplify your Android development - (Kotlin Weekly issue 66 & Android Weekly issue 282)
  • Kotlin Weekly #64
  • Insert Koin for dependency injection
  • Better dependency injection for Android

Talks & podcasts

  • Simplify your Android development with Koin
  • Talking Kotlin - Dependency injection with Koin
  • L'injection de poireaux avec Koin - AndroidLeaks ep42 (French)

Koin developers hub

  • News from the trenches, What's next for Koin?
  • Koin 1.0.0 Unleashed
  • Opening Koin 1.0.0 Beta
  • On the road to Koin 1.0
  • Koin 0.9.2β€Šβ€”β€ŠMaintenance fixes, new branding, roadmap for 1.0.0 & some other nice announces
  • Koin 0.9.1 - Bug fixes & Improvments
  • Koin 0.9.0 - Getting close to stable
  • Unlock your Android ViewModel power with Koin
  • koin 0.8.2 Improvements bugfixes and crash fix
  • Koin release 0.8.0

Contributors

This project exists thanks to all the people who contribute. [Contribute].

OpenCollective

Backers on Open Collective Sponsors on Open Collective

Backers

Thank you to all our backers! πŸ™ [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

About

KOIN - a pragmatic lightweight dependency injection framework for Kotlin

insert-koin.io/

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.