Skip to content

Commit cbf2dea

Browse files
committed
First commit
1 parent 560b36f commit cbf2dea

22 files changed

+1219
-0
lines changed

.gitattributes

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/tests export-ignore
2+
/docs/examples export-ignore
3+
/bin export-ignore
4+
/.github export-ignore
5+
.gitattributes export-ignore
6+
.gitignore export-ignore
7+
.gitmodules export-ignore
8+
.travis.yml export-ignore
9+
.scrutinizer.yml export-ignore
10+
.codeclimate.yml export-ignore
11+
CONTRIBUTING.md export-ignore
12+
CODE_OF_CONDUCT.md export-ignore
13+
CODING_GUIDELINE.md export-ignore
14+
phpunit.xml.dist export-ignore
15+
phpcs.xml.dist export-ignore
16+
composer.lock export-ignore
17+
quality.bat export-ignore
18+
phpstan.neon export-ignore
19+
phpstan_lite.neon export-ignore
20+
phpcs.xml export-ignore
21+
phpmd.xml export-ignore
22+
CNAME export-ignore

.github/workflows/php.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Arangodb extension tests
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
run:
14+
runs-on: ${{ matrix.operating-system }}
15+
timeout-minutes: 60
16+
strategy:
17+
matrix:
18+
operating-system: [ubuntu-latest]
19+
php-versions: ['8.0', '8.1', '8.2', '8.3']
20+
name: PHP ${{ matrix.php-versions }} quality/tests on ${{ matrix.operating-system }}
21+
env:
22+
key: cache-v1
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Install Arangodb Server
28+
run: ./tests/Scripts/install_arangodb.sh
29+
30+
- name: Setup PHP
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php-versions }}
34+
35+
- name: Validate composer.json and composer.lock
36+
run: composer validate --strict
37+
38+
- name: Cache Composer packages
39+
id: composer-cache
40+
uses: actions/cache@v3
41+
with:
42+
path: vendor
43+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
44+
restore-keys: |
45+
${{ runner.os }}-php-
46+
47+
- name: Install dependencies
48+
run: composer install --prefer-dist --no-progress
49+
50+
- name: Run quality tools
51+
run: composer run-script quality
52+
53+
- name: Run tests
54+
run: composer run-script tests

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## 9.2.0
2+
##### 10 january 2024
3+
- __Driver Core__
4+
- Driver is co-maintained by @Geolim4 and @srjlewis
5+
- `Couchbasev4` is now an extension separated from the main Phpfastcache repository.
6+
- `Couchbasev4` requires Couchbase client `Couchbase/Couchbase` 4.x and PHP Extension `Couchbase` 4.x
7+
- `Couchbasev4` may requires `posix`/`pcntl` extension if you are manipulating processes and need to fix an [internal Couchbase bug](README.md#-this-extension-optionally-requires-).

CODE_OF_CONDUCT.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Contributing to PhpFastCache
2+
========================
3+
4+
Please note that this project is released with a
5+
[Contributor Code of Conduct](https://www.contributor-covenant.org/version/1/4/code-of-conduct/).
6+
By participating in this project you agree to abide by its terms.
7+
8+
Reporting Issues
9+
----------------
10+
11+
When reporting issues, please try to be as descriptive as possible, and include
12+
as much relevant information as you can. A step-by-step guide on how to
13+
reproduce the issue will greatly increase the chances of your issue being
14+
resolved in a timely manner.
15+
16+
⚠️ Support for this extension must be posted to the main [Phpfastcache repository](https://github.com/PHPSocialNetwork/phpfastcache/issues).
17+
18+
Contributing policy
19+
-------------------
20+
21+
Our contributing policy is described in our [Coding Guideline (Phpfastcache Repository)](https://github.com/PHPSocialNetwork/phpfastcache/blob/master/CODING_GUIDELINE.md)
22+
23+
Developer notes
24+
-------------------
25+
If you want to contribute to the repository you will need to install/configure some things first.
26+
27+
To run tests follow the steps:
28+
1) Run `composer install` *(Do not ignore platform reqs)*
29+
2) Run `./vendor/bin/phpcs lib/ --report=summary`
30+
3) Run `./vendor/bin/phpmd lib/ ansi phpmd.xml`
31+
4) Run `./vendor/bin/phpstan analyse lib/ -c phpstan_lite.neon 2>&1`
32+
33+
*If you are on Windows environment simply run the file `quality.bat` located at the root of the project to run the step 2, 3 and 4 in once.*
34+
35+
The last command will run all the unit tests of the project.
36+
If an error appears, fix it then you can submit your pull request.
37+
38+
⚠️ **All tests and quality tools MUST pass or the merge request will be automatically closed.**

LICENCE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2023 Phpfastcache & its Extensions
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
Software), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## Contributing [![PHP Tests](https://github.com/PHPSocialNetwork/couchbasev4-extension/actions/workflows/php.yml/badge.svg)](https://github.com/PHPSocialNetwork/couchbasev4-extension/actions/workflows/php.yml)
2+
Merge requests are welcome but will require the tests plus the quality tools to pass:
3+
4+
_(Commands must be run from the repository root)_
5+
### PHPCS, PHPMD, PHPSTAN (Level 6), unit tests:
6+
7+
```bash
8+
composer run-script quality
9+
composer run-script tests
10+
11+
# In case you want to fix the code style automatically:
12+
./vendor/bin/phpcbf lib/ --report=summary
13+
```
14+
15+
## Support & Security
16+
17+
Support for this extension must be posted to the main [Phpfastcache repository](https://github.com/PHPSocialNetwork/phpfastcache/issues).
18+
19+
## Composer installation:
20+
21+
```php
22+
composer install phpfastcache/couchbasev4-extension
23+
```
24+
25+
#### ⚠️ This extension requires:
26+
27+
1️⃣ The PHP `Couchbase` extension 4.x at least
28+
29+
2️⃣ The composer `Couchbase/Couchbase` library 4.x at least
30+
31+
#### ⚠️ This extension optionally requires:
32+
1️⃣ The PHP `Posix` to fix a known Couchbase Extension bug [PCBC-886](https://issues.couchbase.com/projects/PCBC/issues/PCBC-886).
33+
Once this bug has been fixed the dependency suggestion will be removed.
34+
If your application wants to fork the processes using `pcntl_fork()` the `Posix` extension is needed, and you want the fix to be enabled, set up the config like this:
35+
```php
36+
$config = (new CouchbaseConfig())->setDoForkDetection(true);
37+
```
38+
39+
2️⃣ Also the PHP `Pcntl` if you plan to contribute to this project and run the tests before pushing your Merge Request.
40+
41+
42+

SECURITY.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Security Policy
2+
If you discover any vulnerability please be aware of the following table of supported versions below.
3+
Then feel free to contact me at the email address provided in the bottom of that page.
4+
5+
## Supported Versions
6+
7+
Check the details on the [Wiki](https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Global-support-timeline).
8+
9+
As per SEMVER policy, this extension will follow the Phpfastcache *MAJOR and MINOR* version but will have its own *PATCH* versions.
10+
11+
## Reporting a Vulnerability
12+
If you discover any security vulnerability contact me at contact#at#geolim4.com with a subject formatted like that:\
13+
`[PHPFASTCACHE][VULNERABILITY] Your mail subject goes here`
14+
15+
Thanks in advance for taking the time to report me that in private.

composer.json

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"name": "phpfastcache/arangodb-extension",
3+
"type" : "phpfastcache-extension",
4+
"description": "Phpfastcache Arangodb extension",
5+
"keywords": ["cache", "phpfastcache", "arangodb"],
6+
"homepage": "https://github.com/PHPSocialNetwork/arangodb-extension",
7+
"license": "MIT",
8+
"readme": "README.md",
9+
"minimum-stability": "beta",
10+
"authors": [
11+
{
12+
"name": "Georges.L",
13+
"email": "[email protected]",
14+
"homepage": "https://github.com/Geolim4",
15+
"role": "Project Manager"
16+
}
17+
],
18+
"require": {
19+
"php": ">=8.0",
20+
"phpfastcache/phpfastcache": "^9.2",
21+
"triagens/arangodb": "~3.8"
22+
},
23+
"require-dev": {
24+
"phpmd/phpmd": "@stable",
25+
"squizlabs/php_codesniffer": "@stable",
26+
"phpstan/phpstan": "^1.5",
27+
"jetbrains/phpstorm-stubs": "dev-master",
28+
"phpfastcache/phpfastcache-devtools": "^9.2"
29+
},
30+
"autoload": {
31+
"psr-4": {
32+
"Phpfastcache\\Extensions\\": "lib/Phpfastcache/Extensions"
33+
},
34+
"files": [
35+
"lib/ExtensionRegister.php"
36+
]
37+
},
38+
"scripts": {
39+
"phpcs": "vendor/bin/phpcs lib/ --report=summary",
40+
"phpcbf": "vendor/bin/phpcbf lib/ --report=summary",
41+
"phpmd": "vendor/bin/phpmd lib/ ansi phpmd.xml",
42+
"phpstan": "vendor/bin/phpstan analyse lib/ -l 6 -c phpstan.neon",
43+
"quality": ["@phpcs", "@phpmd", "@phpstan"],
44+
"tests": [
45+
"php ./tests/Arangodb.test.php"
46+
]
47+
},
48+
"support": {
49+
"issues": "https://github.com/PHPSocialNetwork/phpfastcache/issues",
50+
"wiki": "https://github.com/PHPSocialNetwork/phpfastcache/wiki",
51+
"docs": "https://github.com/PHPSocialNetwork/phpfastcache/wiki",
52+
"source": "https://github.com/PHPSocialNetwork/phpfastcache",
53+
"security": "https://github.com/PHPSocialNetwork/phpfastcache/blob/master/SECURITY.md"
54+
},
55+
"funding": [
56+
{
57+
"type": "patreon",
58+
"url": "https://www.patreon.com/geolim4"
59+
}
60+
]
61+
}

lib/ExtensionRegister.php

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Phpfastcache;
6+
7+
use Phpfastcache\Extensions\Drivers\Arangodb\{Config, Driver, Event, Item};
8+
9+
// Semver Compatibility until v10
10+
class_alias(Config::class, Drivers\Arangodb\Config::class);
11+
class_alias(Driver::class, Drivers\Arangodb\Driver::class);
12+
class_alias(Event::class, Drivers\Arangodb\Event::class);
13+
class_alias(Item::class, Drivers\Arangodb\Item::class);
14+
15+
ExtensionManager::registerExtension('Arangodb', Driver::class);

0 commit comments

Comments
 (0)