Skip to content

Commit

Permalink
Bump
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Dec 28, 2016
1 parent 31c99c2 commit 534ea81
Show file tree
Hide file tree
Showing 17 changed files with 678 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Dependency Injection (DI)

## Content

- [AutoloaderExtension - autoload classes by definition](#autoloaderextension)

## AutoloaderExtension

At first, you have to register extension.

```yaml
extensions:
autoloader: Contributte\DI\Autoload\DI\AutoloaderExtension
```
### Default configuration
This configuration is enabled by default.
```yaml
autoloader:
dirs:
- %appDir%

annotations:
- @Service

interfaces:
- Contributte\DI\Autoload\AutoloadService

decorator:
inject: off
```
It means, `autoloader` will be looking for all `*.php` classes in folders (`%appDir%`) which:
- implements `Contributte\DI\Autoload\AutoloadService` (OR)
- has the annotation `@Service` (OR)

### Custom configuration

You can override all configuration settings you want to.

```yaml
autoloader:
dirs:
- %appDir%
- %libsDir%
- %fooDir%
annotations:
- @Service
- @MyCustomService
interfaces:
- Minetro\Autoloader\AutoloadService
- App\Model\MyAutoloadServiceInterface
decorator:
inject: on / off
```

### Performance

Service loading is triggered only once at dependency injection container compile-time. You should be pretty fast,
almost as [official registering presenter as services](https://api.nette.org/2.4/source-Bridges.ApplicationDI.ApplicationExtension.php.html#121-160).
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig is awesome: http://EditorConfig.org

# Top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# JS / PHP
[*.{js,php,phpt}]
charset = utf-8
indent_style = tab
indent_size = 4

# NEON
[*.neon]
charset = utf-8
indent_style = tab
indent_size = 4

# Composer, NPM, Travis, BitbucketPipelines
[{composer.json,package.json,.travis.yml,bitbucket-pipelines.yml}]
indent_style = space
indent_size = 2
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# IDE
/.idea

# Composer
/vendor
/composer.lock

# Tests
/tests/*.log
/tests/tmp
/tests/coverage.html
63 changes: 63 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- hhvm
- hhvm-nightly

matrix:
fast_finish: true

allow_failures:
- php: hhvm
- php: hhvm-nightly

include:
- php: 5.6
env: COMPOSER_FLAG=--prefer-lowest
- php: 5.6
env: COMPOSER_FLAG=--prefer-stable
- php: 7.0
env: COMPOSER_FLAG=--prefer-lowest
- php: 7.0
env: COMPOSER_FLAG=--prefer-stable
- php: 7.1
env: COMPOSER_FLAG=--prefer-lowest
- php: 7.1
env: COMPOSER_FLAG=--prefer-stable

before_script:
# Composer
- travis_retry composer install --no-interaction
# Coverage
- if [[ "$TRAVIS_PHP_VERSION" == "7.0" && "$COMPOSER_FLAG" == "" ]]; then COVERAGE=1; fi

script:
# Quality Assurance
- composer run-script qa-linter
- composer run-script qa-codesniffer

# Nette\Tester
- composer run-script qa-tester-info
- composer run-script qa-tester

# Nette\Tester + CodeCoverage
- if [ "$COVERAGE" != "" ]; then composer run-script qa-tester-coverage-info; fi
- if [ "$COVERAGE" != "" ]; then composer run-script qa-tester-coverage; fi

after_script:
# Coverage (Coveralls)
- if [ "$COVERAGE" != "" ]; then wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; fi
- if [ "$COVERAGE" != "" ]; then php coveralls.phar --verbose --config tests/.coveralls.yml; fi

after_failure:
# Print *.actual content
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done

sudo: false

cache:
directories:
- $HOME/.composer/cache
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributte > Dependency Injection (DI)

:sparkles: Extra contribution to [`nette/di`](https://github.com/nette/di).

-----

[![Build Status](https://img.shields.io/travis/contributte/di.svg?style=flat-square)](https://travis-ci.org/contributte/di)
[![Code coverage](https://img.shields.io/coveralls/contributte/di.svg?style=flat-square)](https://coveralls.io/r/contributte/di)
[![HHVM Status](https://img.shields.io/hhvm/contributte/di.svg?style=flat-square)](http://hhvm.h4cc.de/package/contributte/di)
[![Licence](https://img.shields.io/packagist/l/contributte/di.svg?style=flat-square)](https://packagist.org/packages/contributte/di)

[![Downloads this Month](https://img.shields.io/packagist/dm/contributte/di.svg?style=flat-square)](https://packagist.org/packages/contributte/di)
[![Downloads total](https://img.shields.io/packagist/dt/contributte/di.svg?style=flat-square)](https://packagist.org/packages/contributte/di)
[![Latest stable](https://img.shields.io/packagist/v/contributte/di.svg?style=flat-square)](https://packagist.org/packages/contributte/di)
[![Latest unstable](https://img.shields.io/packagist/vpre/contributte/di.svg?style=flat-square)](https://packagist.org/packages/contributte/di)

## Discussion / Help

[![Join the chat](https://img.shields.io/gitter/room/contributte/contributte.svg?style=flat-square)](https://gitter.im/contributte/contributte?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## Install

```
composer require contributte/di
```

## Overview

- [AutoloaderExtension - autoload classes by definition](https://github.com/contributte/di/blob/master/.docs/README.md#autoloaderextension)

---

Thank you for testing, reporting and contributing.
88 changes: 88 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"name": "contributte/di",
"description": "Extra contrib to nette/di",
"keywords": ["nette", "dependency", "inject"],
"type": "library",
"license": "MIT",
"homepage": "https://github.com/contributte/di",
"authors": [
{
"name": "Milan Felix Sulc",
"homepage": "https://jfx.cz"
}
],
"require": {
"php": ">= 5.6",
"nette/di": "^2.4.4",
"nette/reflection": "^2.4.0",
"nette/utils": "^2.4.2"
},
"require-dev": {
"ninjify/qa": "^0.3.3",
"ninjify/nunjuck": "^0.1.4",
"nette/robot-loader": "^2.4.1"
},
"suggest": {
"nette/robot-loader": "to use ServiceAutoloadExtension[CompilerExtension]"
},
"autoload": {
"psr-4": {
"Contributte\\DI\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/cases"
}
},
"scripts": {
"qa": [
"@qa-linter",
"@qa-codesniffer"
],
"ci": [
"@qa-linter",
"@qa-codesniffer",
"@qa-tester-info",
"@qa-tester"
],
"qa-codesniffer": [
"Ninjify\\Composer\\Script\\CodeSniffer::execute"
],
"qa-codefixer": [
"Ninjify\\Composer\\Script\\CodeFixer::execute"
],
"qa-linter": [
"Ninjify\\Composer\\Script\\Linter::execute"
],
"qa-tester": [
"tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php -c tests/php-unix.ini"
],
"qa-tester-info": [
"tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php -c tests/php-unix.ini -i"
],
"qa-tester-coverage": [
"tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php -c tests/php-unix.ini -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src"
],
"qa-tester-coverage-info": [
"tester --setup vendor/bin/nunjuck-setup -j 40 --colors 1 tests/cases -s -p php -c tests/php-unix.ini -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src -i"
]
},
"extra": {
"ninjify": {
"qa": {
"codesniffer": {
"ruleset": "nette",
"folders": ["src", "tests"]
},
"codefixer": {
"ruleset": "nette",
"folders": ["src", "tests"]
},
"linter": {
"folders": ["src", "tests"]
}
}
}
}
}
11 changes: 11 additions & 0 deletions src/Autoload/AutoloadService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Contributte\DI\Autoload;

/**
* @author Milan Felix Sulc <sulcmil@gmail.com>
*/
interface AutoloadService
{

}
Loading

0 comments on commit 534ea81

Please sign in to comment.