Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 540c871
Showing
18 changed files
with
521 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Nettrine MongoDB | ||
|
||
[MongoDB](https://github.com/mongodb/mongo-php-library) to Nette Framework. | ||
|
||
|
||
## Content | ||
- [Setup](#setup) | ||
- [Configuration](#configuration) | ||
- [Examples](#examples) | ||
|
||
|
||
## Setup | ||
|
||
Install package | ||
|
||
```bash | ||
composer require nettrine/mongodb | ||
``` | ||
|
||
Register extension | ||
|
||
```yaml | ||
extensions: | ||
nettrine.mongodb: Nettrine\MongoDB\DI\MongoDBExtension | ||
``` | ||
|
||
## Configuration | ||
|
||
You can look for configuration options here: https://www.php.net/manual/en/mongodb-driver-manager.construct.php | ||
|
||
**Schema definition** | ||
|
||
```yaml | ||
nettrine.mongodb: | ||
uri: <string> | ||
uriOptions: <array> | ||
driverOptions: <array> | ||
``` | ||
|
||
**Under the hood** | ||
|
||
Default URI is: mongodb://127.0.0.1 | ||
|
||
**Side notes** | ||
|
||
1. At this time we support only 1 connection, the **default** connection. If you need more connections (more databases?), please open an issue or send a PR. Thanks. | ||
|
||
|
||
## Other | ||
|
||
This repository is inspired by these packages. | ||
|
||
- https://gitlab.com/nettrine/dbal | ||
|
||
Thank you guys. | ||
|
||
|
||
## Examples | ||
|
||
You can find more examples in [planette playground](https://github.com/planette/playground) repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
indent_size = tab | ||
tab_width = 4 | ||
|
||
[{*.json,*.yml,*.md}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Not archived | ||
.docs export-ignore | ||
tests export-ignore | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.travis.yml export-ignore | ||
Makefile export-ignore | ||
phpstan.neon export-ignore | ||
README.md export-ignore | ||
ruleset.xml export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# IDE | ||
/.idea | ||
|
||
# Composer | ||
/vendor | ||
/composer.lock | ||
|
||
# Tests | ||
/coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
|
||
namespace PHPSTORM_META { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
language: php | ||
php: | ||
- 7.3 | ||
- 7.4 | ||
|
||
before_install: | ||
- phpenv config-rm xdebug.ini || return 0 # Turn off XDebug | ||
- echo "extension = mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini | ||
|
||
install: | ||
- travis_retry composer install --no-progress --prefer-dist | ||
|
||
script: | ||
- make tests | ||
|
||
jobs: | ||
include: | ||
- env: title="Lowest Dependencies 7.3" | ||
php: 7.3 | ||
install: | ||
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable | ||
script: | ||
- make tests | ||
|
||
- stage: Quality Assurance | ||
php: 7.3 | ||
script: | ||
- make qa | ||
|
||
- stage: Test Coverage | ||
if: branch = master AND type = push | ||
php: 7.3 | ||
script: | ||
- make coverage | ||
after_script: | ||
- composer global require php-coveralls/php-coveralls ^2.1.0 | ||
- ~/.composer/vendor/bin/php-coveralls --verbose --config tests/.coveralls.yml | ||
|
||
- stage: Outdated Dependencies | ||
if: branch = master AND type = cron | ||
php: 7.3 | ||
script: | ||
- composer outdated --direct | ||
|
||
allow_failures: | ||
- stage: Test Coverage | ||
- php: nightly | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Nettrine | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.PHONY: qa lint cs csf phpstan tests coverage | ||
|
||
all: | ||
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs | ||
|
||
vendor: composer.json composer.lock | ||
composer install | ||
|
||
qa: lint phpstan cs | ||
|
||
lint: vendor | ||
vendor/bin/linter src tests | ||
|
||
cs: vendor | ||
vendor/bin/codesniffer src tests | ||
|
||
csf: vendor | ||
vendor/bin/codefixer src tests | ||
|
||
phpstan: vendor | ||
vendor/bin/phpstan analyse -l max -c phpstan.neon src | ||
|
||
tests: vendor | ||
vendor/bin/phpunit tests --cache-result-file=tests/tmp/phpunit.cache --colors=always | ||
|
||
coverage: vendor | ||
phpdbg -qrr vendor/bin/phpunit tests --cache-result-file=tests/tmp/phpunit.cache --colors=always -c tests/coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Nettrine MongoDB | ||
|
||
[MongoDB](https://github.com/mongodb/mongo-php-library) to Nette Framework. | ||
|
||
[![Build Status](https://img.shields.io/travis/nettrine/mongodb.svg?style=flat-square)](https://travis-ci.org/nettrine/mongodb) | ||
[![Code coverage](https://img.shields.io/coveralls/nettrine/mongodb.svg?style=flat-square)](https://coveralls.io/r/nettrine/mongodb) | ||
[![Licence](https://img.shields.io/packagist/l/nettrine/mongodb.svg?style=flat-square)](https://packagist.org/packages/nettrine/mongodb) | ||
[![Downloads this Month](https://img.shields.io/packagist/dm/nettrine/mongodb.svg?style=flat-square)](https://packagist.org/packages/nettrine/mongodb) | ||
[![Downloads total](https://img.shields.io/packagist/dt/nettrine/mongodb.svg?style=flat-square)](https://packagist.org/packages/nettrine/mongodb) | ||
[![Latest stable](https://img.shields.io/packagist/v/nettrine/mongodb.svg?style=flat-square)](https://packagist.org/packages/nettrine/mongodb) | ||
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat-square)](https://github.com/phpstan/phpstan) | ||
|
||
## Discussion / Help | ||
|
||
[![Join the chat](https://img.shields.io/gitter/room/nettrine/nettrine.svg?style=flat-square)](https://gitter.im/nettrine/nettrine) | ||
|
||
## Documentation | ||
|
||
- [Setup](.docs/README.md#setup) | ||
- [Configuration](.docs/README.md#configuration) | ||
- [Examples](.docs/README.md#examples) | ||
|
||
## Versions | ||
|
||
| State | Version | Branch | Nette | PHP | | ||
|-------------|-------------|----------|--------|--------| | ||
| dev | `^0.1` | `master` | `3.0+` | `^7.3` | | ||
|
||
## Maintainers | ||
|
||
<table> | ||
<tbody> | ||
<tr> | ||
<td align="center"> | ||
<a href="https://github.com/solcik"> | ||
<img width="150" height="150" src="https://avatars2.githubusercontent.com/u/1543737?v=3&s=150"> | ||
</a> | ||
</br> | ||
<a href="https://github.com/solcik">David Šolc</a> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
Thank you for testing, reporting and contributing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "nettrine/mongodb", | ||
"description": "MongoDB for Nette Framework", | ||
"keywords": ["nette", "doctrine", "mongodb", "database", "document"], | ||
"type": "library", | ||
"license": "MIT", | ||
"homepage": "https://github.com/nettrine/mongodb", | ||
"authors": [ | ||
{ | ||
"name": "David Šolc", | ||
"homepage": "https://solc.dev" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.3", | ||
"ext-mongodb": "*", | ||
"mongodb/mongodb": "^1.5.2", | ||
"nette/di": "^3.0.3", | ||
"nette/schema": "^1.0.2" | ||
}, | ||
"require-dev": { | ||
"mockery/mockery": "^1.3.1", | ||
"ninjify/qa": "^0.9.0", | ||
"phpstan/extension-installer": "^1.0.3", | ||
"phpstan/phpstan": "^0.12.0", | ||
"phpstan/phpstan-deprecation-rules": "^0.12.2", | ||
"phpstan/phpstan-nette": "^0.12.3", | ||
"phpstan/phpstan-strict-rules": "^0.12.2", | ||
"phpunit/phpunit": "^8.5.2" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Nettrine\\MongoDB\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tests\\Cases\\": "tests/cases", | ||
"Tests\\Fixtures\\": "tests/fixtures", | ||
"Tests\\Toolkit\\": "tests/toolkit" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "0.1.x-dev" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
parameters: | ||
paths: | ||
- ./src | ||
- ./tests | ||
level: max | ||
ignoreErrors: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0"?> | ||
<ruleset> | ||
<!-- Contributte Coding Standard --> | ||
<rule ref="./vendor/ninjify/coding-standard/contributte.xml"> | ||
<exclude name="SlevomatCodingStandard.ControlStructures.RequireTernaryOperator.TernaryOperatorNotUsed"/> | ||
<exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountBeforeControlStructure"/> | ||
<exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountAfterControlStructure"/> | ||
<exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountAfterLastControlStructure"/> | ||
<exclude name="SlevomatCodingStandard.ControlStructures.RequireMultiLineTernaryOperator.MultiLineTernaryOperatorNotUsed"/> | ||
</rule> | ||
|
||
<!-- Specific --> | ||
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName"> | ||
<properties> | ||
<property name="rootNamespaces" type="array" value=" | ||
src=>Nettrine\MongoDB, | ||
tests/cases=>Tests\Cases, | ||
tests/fixtures=>Tests\Fixtures, | ||
tests/toolkit=>Tests\Toolkit | ||
"/> | ||
</properties> | ||
</rule> | ||
|
||
<!-- Tests specific --> | ||
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.UselessDocComment"> | ||
<exclude-pattern>/tests/cases</exclude-pattern> | ||
</rule> | ||
|
||
<!--Exclude folders --> | ||
<exclude-pattern>/tests/tmp</exclude-pattern> | ||
</ruleset> |
Oops, something went wrong.