Skip to content

Commit

Permalink
Merge 2928b07 into 4d8de74
Browse files Browse the repository at this point in the history
  • Loading branch information
ravanscafi committed Sep 26, 2019
2 parents 4d8de74 + 2928b07 commit aec7a35
Show file tree
Hide file tree
Showing 127 changed files with 11,478 additions and 8,868 deletions.
23 changes: 23 additions & 0 deletions .gitattributes
@@ -0,0 +1,23 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
# Folders
/.github export-ignore
/docs export-ignore
/tests export-ignore
# Files
/.coveralls.yml export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/CODE_OF_CONDUCT.md export-ignore
/composer.lock export-ignore
/docker-compose.override.yml.example export-ignore
/docker-compose.yml export-ignore
/Makefile export-ignore
/mkdocs.yml export-ignore
/phpcs.xml export-ignore
/phpunit.xml export-ignore
/phpunit.xml.dist export-ignore
/sami.php export-ignore
52 changes: 52 additions & 0 deletions .github/pre-commit
@@ -0,0 +1,52 @@
#!/bin/bash

STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR | grep \.php`

# Determine if a file list is passed
if [ "$#" -eq 1 ]
then
oIFS=$IFS
IFS='
'
SFILES="$1"
IFS=$oIFS
fi
SFILES=${SFILES:-$STAGED_FILES_CMD}

# Fix path for docker
for FILE in $SFILES
do
FILES="$FILES $FILE"
done

if [ "$FILES" != "" ]
then
echo -e "\033[1;33m"Running Code Sniffer..."\033[0m"
docker-compose run --rm --no-deps -T php vendor/bin/phpcs $FILES

if [ $? != 0 ]
then
# Allows us to read user input below, assigns stdin to keyboard
exec < /dev/tty

read -p "There are some Coding Standards violations. Do you want to fix the auto-fixable ones? (Yes) " choice
[ "$choice" = "" ] && choice='Y'

case ${choice:0:1} in
y|Y )
echo -e "\033[1;33m"Running Code Beautifier..."\033[0m"
docker-compose run --rm --no-deps -T php vendor/bin/phpcbf $FILES
echo -e "\033[0;32m"Done. Please add the fixes before commit."\033[0m"

exit 1
;;
* )
echo -e "\033[41m"Please, fix the Coding Standards violations before commit."\033[0m"

exit 1
;;
esac
fi
fi

exit $?
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -2,4 +2,6 @@
/.coverage
/build
/site
composer.lock
.phpcs-cache
.phpunit.result.cache
docker-compose.override.yml
1 change: 0 additions & 1 deletion .styleci.yml

This file was deleted.

20 changes: 12 additions & 8 deletions .travis.yml
@@ -1,20 +1,24 @@
language: php

php:
- 7.0
- 7.1
- 7.2
- 7.3

cache:
directories:
- $HOME/.composer/cache

services: mongodb

before_install:
- if [[ $TRAVIS_PHP_VERSION != 7.2 ]]; then pecl install mongodb; fi
- echo "extension = mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- pecl install mongodb > /dev/null

before_script:
- composer install --no-interaction

script:
- mkdir -p build/logs
- vendor/bin/phpunit -c phpunit.xml.dist && make sniff
- vendor/bin/phpcs
- vendor/bin/phpunit -c phpunit.xml.dist

after_script:
- php vendor/bin/coveralls -v
after_success:
- if [[ $(phpenv version-name) = "7.3" ]]; then php vendor/bin/php-coveralls -v; fi
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2013-2017 Leroy Merlin Brasil
Copyright (c) Leroy Merlin Brazil

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Makefile
@@ -1,5 +1,5 @@
sniff:
docker-compose run --rm php vendor/bin/phpcs ./src --standard='./coding_standard.xml' -n
docker-compose run --rm php vendor/bin/phpcs

phpunit:
docker-compose run --rm php vendor/bin/phpunit
Expand Down
88 changes: 24 additions & 64 deletions README.md
@@ -1,85 +1,45 @@
# Mongolid ODM for MongoDB (PHP7)
# Mongolid ODM for MongoDB

> Easy, powerful and ultrafast ODM for PHP7 build on top of the [new mongodb driver](https://docs.mongodb.org/ecosystem/drivers/php/).
<p align="center"><img src="https://user-images.githubusercontent.com/1991286/28967747-fe5c258a-78f2-11e7-91c7-8850ffb32004.png" alt="Mongolid"></p>

![Mongolid](https://user-images.githubusercontent.com/1991286/28967747-fe5c258a-78f2-11e7-91c7-8850ffb32004.png)
<p align="center">
<a href="https://travis-ci.org/leroy-merlin-br/mongolid"><img src="https://travis-ci.org/leroy-merlin-br/mongolid.svg?branch=master" alt="Build Status"></a>
<a href="https://coveralls.io/github/leroy-merlin-br/mongolid?branch=master"><img src="https://coveralls.io/repos/github/leroy-merlin-br/mongolid/badge.svg?branch=master" alt="Coverage Status"></a>
<a href="https://packagist.org/packages/leroy-merlin-br/mongolid"><img src="https://poser.pugx.org/leroy-merlin-br/mongolid/v/stable" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/leroy-merlin-br/mongolid"><img src="https://poser.pugx.org/leroy-merlin-br/mongolid/downloads" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/leroy-merlin-br/mongolid"><img src="https://poser.pugx.org/leroy-merlin-br/mongolid/license" alt="License"></a>
</p>

Mongolid supports both **ActiveRecord** and **DataMapper** patterns. **You choose! (:**
## About Mongolid
Easy, powerful and ultrafast ODM for PHP 7.1+ build on top of the [new mongodb driver](https://docs.mongodb.org/ecosystem/drivers/php/).

[![Build Status](https://travis-ci.org/leroy-merlin-br/mongolid.svg?branch=master)](https://travis-ci.org/leroy-merlin-br/mongolid)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/cc45e93bb0d0413d9e0355c7377d4d33)](https://www.codacy.com/app/zizaco/mongolid?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=leroy-merlin-br/mongolid&amp;utm_campaign=Badge_Grade)
[![StyleCI](https://styleci.io/repos/9799450/shield?branch=master)](https://styleci.io/repos/9799450)
[![Coverage Status](https://coveralls.io/repos/github/leroy-merlin-br/mongolid/badge.svg?branch=master)](https://coveralls.io/github/leroy-merlin-br/mongolid?branch=master)
[![Latest Stable Version](https://poser.pugx.org/leroy-merlin-br/mongolid/v/stable)](https://packagist.org/packages/leroy-merlin-br/mongolid)
[![Total Downloads](https://poser.pugx.org/leroy-merlin-br/mongolid/downloads)](https://packagist.org/packages/leroy-merlin-br/mongolid)
[![Latest Unstable Version](https://poser.pugx.org/leroy-merlin-br/mongolid/v/unstable)](https://packagist.org/packages/leroy-merlin-br/mongolid)
[![License](https://poser.pugx.org/leroy-merlin-br/mongolid/license)](https://packagist.org/packages/leroy-merlin-br/mongolid)
Mongolid supports **ActiveRecord** pattern.

[![SensioLabsInsight](https://insight.sensiolabs.com/projects/25636a94-9a5d-4438-bd5e-9f9694104529/small.png)](https://insight.sensiolabs.com/projects/25636a94-9a5d-4438-bd5e-9f9694104529)

<a name="introduction"></a>
## Introduction

Mongolid ODM (Object Document Mapper) provides a beautiful, simple implementation for working with MongoDB. Each database collection can have a corresponding "Model" which is used to interact with that collection.

> **Note:** If you are working with Laravel, take a look at [mongolid-laravel repository](https://github.com/leroy-merlin-br/mongolid-laravel).
<a name="installation"></a>
## Installation

You can install library through Composer:

```
$ composer require leroy-merlin-br/mongolid
```
**Note:** If you are working with Laravel, take a look at [mongolid-laravel repository](https://github.com/leroy-merlin-br/mongolid-laravel).

### Requirements

- PHP**7**
## Requirements
- PHP **7.1** or superior
- [MongoDB Driver](http://php.net/manual/en/set.mongodb.php)

> **Note:** If you are looking for the old PHP 5.x version, head to the [v0.8 branch](https://github.com/leroy-merlin-br/mongolid/tree/v0.8-dev).
## [Read the Docs: <small>leroy-merlin-br.github.com/mongolid</small>](http://leroy-merlin-br.github.com/mongolid)
[![Mongolid Docs](https://dl.dropboxusercontent.com/u/12506137/libs_bundles/MongolidDocs.png)](http://leroy-merlin-br.github.com/mongolid)

<a name="troubleshooting"></a>
## Troubleshooting

**"PHP Fatal error: Class 'MongoDB\Client' not found in ..."**

The `MongoDB\Client` class is contained in the [**new** MongoDB driver](http://pecl.php.net/package/mongodb) for PHP. [Here is an installation guide](http://www.php.net/manual/en/mongodb.installation.php). The driver is a PHP extension written in C and maintained by [MongoDB](https://mongodb.com). Mongolid and most other MongoDB PHP libraries utilize it in order to be fast and reliable.

**"Class 'MongoDB\Client' not found in ..." in CLI persists even with MongoDB driver installed.**

Make sure that the **php.ini** file used in the CLI environment includes the MongoDB extension. In some systems, the default PHP installation uses different **.ini** files for the web and CLI environments.

Run `php -i | grep 'Configuration File'` in a terminal to check the **.ini** that is being used.

To check if PHP in the CLI environment is importing the driver properly run `php -i | grep -i 'mongo'` in your terminal. You should get output similar to:
## Installation
You can install the library through Composer:

```
$ php -i | grep -i 'mongo'
MongoDB support => enabled
MongoDB extension version => 1.2.8
MongoDB extension stability => stable
libmongoc bundled version => 1.5.5
$ composer require leroy-merlin-br/mongolid
```

**"This package requires php >=7.0 but your PHP version (X.X.X) does not satisfy that requirement."**

The new (and improved) version 2.0 of Mongolid requires php7. If you are looking for the old PHP 5.x version, head to the [v0.8 branch](https://github.com/leroy-merlin-br/mongolid/tree/v0.8-dev).
## Documentation
You can access the full documentation [here](http://leroy-merlin-br.github.com/mongolid).

<a name="license"></a>
## License
Mongolid is free software distributed under the terms of the [MIT license](LICENSE).

Mongolid is free software distributed under the terms of the [MIT license](http://opensource.org/licenses/MIT)

<a name="additional_information"></a>
## Additional information
Made with ❤ by [Leroy Merlin Brazil](https://github.com/leroy-merlin-br) and [all contributors](https://github.com/leroy-merlin-br/mongolid/graphs/contributors).

Mongolid was proudly built by the [Leroy Merlin Brazil](https://github.com/leroy-merlin-br) team. [See all the contributors](https://github.com/leroy-merlin-br/mongolid/graphs/contributors).

Any questions, feel free to contact us.
If you have any questions, feel free to contact us.

Any issues, please [report here](https://github.com/Zizaco/mongolid)
If you any issues, please [report here](https://github.com/leroy-merlin-br/mongolid/issues).
12 changes: 0 additions & 12 deletions bootstrap/bootstrap.php

This file was deleted.

7 changes: 0 additions & 7 deletions coding_standard.xml

This file was deleted.

44 changes: 29 additions & 15 deletions composer.json
@@ -1,7 +1,7 @@
{
"name": "leroy-merlin-br/mongolid",
"description": "Easy, powerful and ultrafast ODM for PHP and MongoDB.",
"keywords": ["odm","mongodb","nosql"],
"keywords": ["odm", "mongodb", "mongo", "nosql", "active record", "laravel"],
"license": "MIT",
"authors": [
{
Expand All @@ -11,31 +11,45 @@
{
"name": "Guilherme Guitte",
"email": "guilherme.guitte@gmail.com"
},
{
"name": "Boitatá",
"email": "boitata@leroymerlin.com.br"
}
],
"require": {
"php": ">=7.0",
"mongodb/mongodb": "^1.3",
"illuminate/container": "^5.4"
"php": ">=7.2",
"ext-mongodb": "*",
"mongodb/mongodb": "^1.4",
"illuminate/container": "^5.4 || ^6.0"
},
"require-dev": {
"mockery/mockery": "^1.0",
"satooshi/php-coveralls": "^1.0",
"phpunit/phpunit": "^6.4",
"squizlabs/php_codesniffer": "^2.0",
"sami/sami": "^4.0"
"leroy-merlin-br/coding-standard": "^0.1",
"mockery/mockery": "^1.2",
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^7.0 || ^8.0",
"sami/sami": "^4.1"
},
"autoload": {
"psr-4": {
"Mongolid\\": "src/Mongolid"
},
"classmap": [
"tests/TestCase.php"
]
"Mongolid\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Mongolid\\": "tests/Unit",
"Mongolid\\Tests\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-master": "v2.1.x-dev"
"dev-master": "v3.0.x-dev"
}
},
"config": {
"sort-packages": true
},
"suggest": {
"leroy-merlin-br/mongolid-laravel": "Easy, powerful and ultrafast MongoDB ODM for Laravel."
}
}

0 comments on commit aec7a35

Please sign in to comment.