{"id":22401646,"url":"https://github.com/d3fvxl/di","last_synced_at":"2026-01-12T01:57:21.867Z","repository":{"id":45735583,"uuid":"238040345","full_name":"d3fvxl/di","owner":"d3fvxl","description":"🛠 A full-featured dependency injection container for go programming language.","archived":false,"fork":false,"pushed_at":"2023-12-16T19:46:52.000Z","size":312,"stargazers_count":238,"open_issues_count":3,"forks_count":13,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-10-09T12:03:05.639Z","etag":null,"topics":["dependency-injection","di","go","ioc","ioc-container"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d3fvxl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-02-03T19:06:39.000Z","updated_at":"2025-05-30T20:13:39.000Z","dependencies_parsed_at":"2024-01-03T01:18:08.839Z","dependency_job_id":"b7029c45-12e8-4c47-bdba-7f2a7b8d5bcb","html_url":"https://github.com/d3fvxl/di","commit_stats":null,"previous_names":["defval/di","goava/di","d3fvxl/di"],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/d3fvxl/di","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3fvxl%2Fdi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3fvxl%2Fdi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3fvxl%2Fdi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3fvxl%2Fdi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d3fvxl","download_url":"https://codeload.github.com/d3fvxl/di/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3fvxl%2Fdi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28331396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependency-injection","di","go","ioc","ioc-container"],"created_at":"2024-12-05T09:01:17.531Z","updated_at":"2026-01-12T01:57:21.854Z","avatar_url":"https://github.com/d3fvxl.png","language":"Go","readme":"# DI\n\n[![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=for-the-badge\u0026logo=go)](https://pkg.go.dev/github.com/defval/di)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/defval/di?logo=semver\u0026style=for-the-badge)](https://github.com/defval/di/releases/latest)\n[![GitHub Workflow Status (with branch)](https://img.shields.io/github/actions/workflow/status/defval/di/go.yml?branch=master\u0026logo=github-actions\u0026style=for-the-badge)](https://github.com/defval/di/actions/workflows/go.yml)\n[![Go Report Card](https://img.shields.io/badge/go%20report-A%2B-green?style=for-the-badge)](https://goreportcard.com/report/github.com/defval/di)\n[![Codecov](https://img.shields.io/codecov/c/github/defval/di?logo=codecov\u0026style=for-the-badge)](https://codecov.io/gh/defval/di)\n\n**DI** is a dependency injection library for the Go programming language.\n\nDependency injection is a form of inversion of control that increases modularity and extensibility in your programs.\nThis library helps you organize responsibilities in your codebase and makes it easy to combine low-level implementations\ninto high-level behavior without boilerplate.\n\n## Features\n\n- Intuitive auto wiring\n- Interface implementations\n- Constructor injection\n- Optional injection\n- Field injection\n- Lazy-loading\n- Tagging\n- Grouping\n- Iteration\n- Decoration\n- Cleanup\n- Container Chaining / Scopes\n\n## Installation\n\n```shell\ngo get github.com/defval/di\n```\n\n## Documentation\n\nYou can use the standard [pkg.go.dev](https://pkg.go.dev/github.com/defval/di) and inline code comments. If you are new\nto auto-wiring libraries such as [google/wire](https://github.com/google/wire)\nor [uber-go/dig](https://github.com/uber-go/dig), start with the [tutorial](./docs/tutorial.md).\n\n### Essential Reading\n\n- [Tutorial](./docs/tutorial.md)\n- [Examples](./_examples)\n- [Advanced Features](./docs/advanced.md)\n\n## Example Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/signal\"\n\t\"syscall\"\n\n\t\"github.com/defval/di\"\n)\n\nfunc main() {\n\tdi.SetTracer(\u0026di.StdTracer{})\n\t// create container\n\tc, err := di.New(\n\t\tdi.Provide(NewContext),  // provide application context\n\t\tdi.Provide(NewServer),   // provide http server\n\t\tdi.Provide(NewServeMux), // provide http serve mux\n\t\t// controllers as []Controller group\n\t\tdi.Provide(NewOrderController, di.As(new(Controller))),\n\t\tdi.Provide(NewUserController, di.As(new(Controller))),\n\t)\n\t// handle container errors\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// invoke function\n\tif err := c.Invoke(StartServer); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\nFull code available [here](./_examples/tutorial/main.go).\n\n## Questions\n\nIf you have any questions, feel free to create an issue.\n","funding_links":[],"categories":["Go","Miscellaneous"],"sub_categories":["Dependency Injection"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd3fvxl%2Fdi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd3fvxl%2Fdi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd3fvxl%2Fdi/lists"}