Skip to main content
This release is 2 versions behind 0.2.1 — the latest version of @findhow/container. Jump to latest

Built and signed on GitHub Actions

Wasn't a fan of using decorators to dependency inject things in the TypeScript world. Now you don't have to.

This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
a week ago (0.1.0)
interface LaravelContainer

Interface representing a Laravel-style container.

Methods

alias(
abstract: Abstract,
alias: string,
): void
tag(
abstracts: Abstract | Abstract[],
tags: string | string[],
): void
tagged(tag: string): any[]
bind(
abstract: Abstract,
concrete?: Function | Abstract,
shared?: boolean,
): void
bindMethod(
method: string | [string, string],
callback: Function,
): void
bindIf(
abstract: Abstract,
concrete?: Function | Abstract,
shared?: boolean,
): void
singleton(
abstract: Abstract,
concrete?: Function | Abstract,
): void
singletonIf(
abstract: Abstract,
concrete?: Function | Abstract,
): void
scoped(
abstract: Abstract,
concrete?: Function | Abstract,
): void
scopedIf(
abstract: Abstract,
concrete?: Function | Abstract,
): void
extend(
abstract: Abstract,
closure: Function,
): void
instance(
abstract: Abstract,
instance: any,
): void
addContextualBinding(
concrete: Abstract,
abstract: Abstract,
implementation: Function | Abstract,
): void
flush(): void
make(
abstract: Abstract,
parameters?: any[],
): any
call(
callback: Function | string,
parameters?: any[],
defaultMethod?: string,
): any
beforeResolving(
abstract: Abstract | Function,
callback?: Function,
): void
resolving(
abstract: Abstract | Function,
callback?: Function,
): void
afterResolving(
abstract: Abstract | Function,
callback?: Function,
): void
register<T>(
constructor: Constructor<T>,
paramTypes: (Bindable | Bindable[])[],
): void

Add Package

deno add jsr:@findhow/container

Import symbol

import { type LaravelContainer } from "@findhow/container/container";

---- OR ----

Import directly with a jsr specifier

import { type LaravelContainer } from "jsr:@findhow/container/container";

Add Package

npx jsr add @findhow/container

Import symbol

import { type LaravelContainer } from "@findhow/container/container";

Add Package

yarn dlx jsr add @findhow/container

Import symbol

import { type LaravelContainer } from "@findhow/container/container";

Add Package

pnpm dlx jsr add @findhow/container

Import symbol

import { type LaravelContainer } from "@findhow/container/container";

Add Package

bunx jsr add @findhow/container

Import symbol

import { type LaravelContainer } from "@findhow/container/container";