# givemetheservice

> ES6 dependency injection container.

Latest version **2.0.4** (published 2020-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install givemetheservice
pnpm add givemetheservice
yarn add givemetheservice
bun add givemetheservice
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2020-02-27 |
| First published | 2018-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 20.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Benoît Claveau |
| Maintainers | benoit.claveau |
| Keywords | dependency-injection, injection, injector |

## Links

- npm: https://www.npmjs.com/package/givemetheservice
- Repository: https://github.com/BenoitClaveau/givemetheservice
- Issues: https://github.com/BenoitClaveau/givemetheservice/issues
- npm.io page: https://npm.io/package/givemetheservice

## Dependencies (3)

- [oups](https://npm.io/package/oups.md) latest
- [uuid](https://npm.io/package/uuid.md) latest
- [diacritics](https://npm.io/package/diacritics.md) latest

## Recent versions

- 2.0.4 (latest) — 2020-02-27
- 2.0.3 — 2019-12-28
- 2.0.2 — 2019-12-28
- 2.0.1 — 2019-12-28
- 2.0.0 — 2019-12-28
- 1.2.4 — 2019-03-13
- 1.2.3 — 2019-03-13
- 1.2.2 — 2019-01-16
- 1.2.1 — 2019-01-16
- 1.2.0 — 2019-01-16
- 1.1.2 — 2018-12-04
- 1.1.1 — 2018-11-30
- 1.1.0 — 2018-11-30
- 1.0.11 — 2018-10-30
- 1.0.10 — 2018-10-24
- … 10 more at https://npm.io/package/givemetheservice/versions

## README

# Give Me The Service

Give me the service is a ES6 dependency injection container for OOP.

 [![NPM][npm-image]][npm-url]
 [![Build Status][travis-image]][travis-url]
 [![Coverage Status][coveralls-image]][coveralls-url]
 [![NPM Download][npm-image-download]][npm-url]
 [![Dependencies Status][david-dm-image]][david-dm-url]

```shell
npm install givemetheservice --save
```

# Features

  * [Services](#services) 
  * [Dependency injection](#di)
  * [Configuration](#config)
  
## Services
<a name="service"/>

Develop your own service in a separate file. Your don't need to instanciate it. GiveMeTheService [DI](#di) do that job. If you use another service just inject it in your constructor.

> What is the main avantage to use DI ?
>
> You could easily override any service. Unit testing will be easy.

<a name="di"/>
## Dependency injection

Just declare the service name in your constructor.
Injected services are created as singleton.

```services/user.js
class UserService {
    constructor(config)
```

GiveMeTheService will create your service with its dependencies.

### Lifecycle

1. inject
1. create()
1. mount()
1. unmount()
  
## Test

To run our tests, clone the Qwebs repo and install the dependencies.

```bash
$ git clone https://github.com/BenoitClaveau/givemetheservice --depth 1
$ cd givemetheservice
$ npm install
$ cd tests
$ node.exe "../node_modules/mocha/bin/mocha" .
```

[npm-image]: https://img.shields.io/npm/v/givemetheservice.svg
[npm-image-download]: https://img.shields.io/npm/dm/givemetheservice.svg
[npm-url]: https://npmjs.org/package/givemetheservice
[travis-image]: https://travis-ci.org/BenoitClaveau/givemetheservice.svg?branch=master
[travis-url]: https://travis-ci.org/BenoitClaveau/givemetheservice
[coveralls-image]: https://coveralls.io/repos/BenoitClaveau/givemetheservice/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/BenoitClaveau/givemetheservice?branch=master
[david-dm-image]: https://david-dm.org/BenoitClaveau/givemetheservice/status.svg
[david-dm-url]: https://david-dm.org/BenoitClaveau/givemetheservice

---
_Source: https://npm.io/package/givemetheservice · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
