GithubHelp home page GithubHelp logo

muskanmahajan37 / koin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ermolnik/koin

0.0 0.0 0.0 73.99 MB

KOIN - a pragmatic lightweight dependency injection framework for Kotlin

Home Page: https://insert-koin.io/

License: Apache License 2.0

Kotlin 91.98% Shell 0.11% CSS 7.03% Java 0.89%

koin's Introduction

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

Latest News 🌐

Getting Help πŸš’

Any question about Koin usage?

Articles, Videos & other resources πŸŽ‰

All online resources about Koin πŸ‘‰ Talking about Koin

Reporting issues πŸ› 

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

Old 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-androidx-scope:$koin_version"
// Koin AndroidX ViewModel features
implementation "org.koin:koin-androidx-viewmodel:$koin_version"
// Koin AndroidX Experimental features
implementation "org.koin:koin-androidx-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)
    }
  } 
} 

Talking about Koin

Articles

Videos & Podcasts

Koin Developers Hub

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]

koin's People

Contributors

arnaudgiuliani avatar erickok avatar fredy-mederos avatar jschmid avatar cortinico avatar amaksoft avatar mpontus avatar viniciusccarvalho avatar ychescale9 avatar tynn avatar wdoeland avatar lesraf avatar michael-oknov avatar leocolman avatar voghdev avatar pedroql avatar razeeman avatar teregulovrustem avatar chubecode avatar jeevuz avatar kondenko avatar vladimirwrites avatar wcarmon avatar wilder avatar wojteko22 avatar yolave avatar trietbui85 avatar ashraf-patel avatar ligi avatar ucodeustory avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.