Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Geolim4 committed Jan 7, 2024
1 parent b7fb42a commit 20bb0cd
Show file tree
Hide file tree
Showing 22 changed files with 1,171 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/tests export-ignore
/docs/examples export-ignore
/bin export-ignore
/.github export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.travis.yml export-ignore
.scrutinizer.yml export-ignore
.codeclimate.yml export-ignore
CONTRIBUTING.md export-ignore
CODE_OF_CONDUCT.md export-ignore
CODING_GUIDELINE.md export-ignore
phpunit.xml.dist export-ignore
phpcs.xml.dist export-ignore
composer.lock export-ignore
quality.bat export-ignore
phpstan.neon export-ignore
phpstan_lite.neon export-ignore
phpcs.xml export-ignore
phpmd.xml export-ignore
CNAME export-ignore
54 changes: 54 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Solr extension tests

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
run:
runs-on: ${{ matrix.operating-system }}
timeout-minutes: 60
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.0', '8.1', '8.2', '8.3']
name: PHP ${{ matrix.php-versions }} quality/tests on ${{ matrix.operating-system }}
env:
key: cache-v1
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Solr Server
run: ./tests/Scripts/install_solr.sh

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run quality tools
run: composer run-script quality

- name: Run tests
run: composer run-script tests
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 9.2.0
##### 10 january 2024
- __Driver Core__
- Driver is maintained by @Geolim4
- `Xouchdb` is now an extension separated from the main Phpfastcache repository.
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

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.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

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.

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.

## Scope

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.

## Enforcement

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.

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.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Contributing to PhpFastCache
========================

Please note that this project is released with a
[Contributor Code of Conduct](https://www.contributor-covenant.org/version/1/4/code-of-conduct/).
By participating in this project you agree to abide by its terms.

Reporting Issues
----------------

When reporting issues, please try to be as descriptive as possible, and include
as much relevant information as you can. A step-by-step guide on how to
reproduce the issue will greatly increase the chances of your issue being
resolved in a timely manner.

⚠️ Support for this extension must be posted to the main [Phpfastcache repository](https://github.com/PHPSocialNetwork/phpfastcache/issues).

Contributing policy
-------------------

Our contributing policy is described in our [Coding Guideline (Phpfastcache Repository)](https://github.com/PHPSocialNetwork/phpfastcache/blob/master/CODING_GUIDELINE.md)

Developer notes
-------------------
If you want to contribute to the repository you will need to install/configure some things first.

To run tests follow the steps:
1) Run `composer install` *(Do not ignore platform reqs)*
2) Run `./vendor/bin/phpcs lib/ --report=summary`
3) Run `./vendor/bin/phpmd lib/ ansi phpmd.xml`
4) Run `./vendor/bin/phpstan analyse lib/ -c phpstan_lite.neon 2>&1`

*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.*

The last command will run all the unit tests of the project.
If an error appears, fix it then you can submit your pull request.

⚠️ **All tests and quality tools MUST pass or the merge request will be automatically closed.**
20 changes: 20 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2023 Phpfastcache & its Extensions

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.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Contributing [![PHP Tests](https://github.com/PHPSocialNetwork/solr-extension/actions/workflows/php.yml/badge.svg)](https://github.com/PHPSocialNetwork/solr-extension/actions/workflows/php.yml)
Merge requests are welcome but will require the tests plus the quality tools to pass:

_(Commands must be run from the repository root)_
### PHPCS, PHPMD, PHPSTAN (Level 6), unit tests:

```bash
composer run-script quality
composer run-script tests

# In case you want to fix the code style automatically:
composer run-script phpcbf
```

## Support & Security

Support for this extension must be posted to the main [Phpfastcache repository](https://github.com/PHPSocialNetwork/phpfastcache/issues).

## Composer installation:

```php
composer install phpfastcache/solr-extension
```

#### ⚠️ This extension requires:
1️ The composer `solarium/solarium` library `6.1` at least.

## Events
This driver is emitting [customs events](https://github.com/PHPSocialNetwork/phpfastcache/blob/master/docs/EVENTS.md):

- onSolrBuildEndpoint(*Callable* **$callback**)
- **Callback arguments**
- *ExtendedCacheItemPoolInterface* **$itemPool**
- *EventReferenceParameter($params)* **$endpoints** _via EventReferenceParameter object_ **(type modification forbidden)**
- **Scope**
- Solr Driver
- **Description**
- Allow you to alter the endpoints built used to connect to Solr server
- **Risky Circular Methods**: None
15 changes: 15 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Security Policy
If you discover any vulnerability please be aware of the following table of supported versions below.
Then feel free to contact me at the email address provided in the bottom of that page.

## Supported Versions

Check the details on the [Wiki](https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Global-support-timeline).

As per SEMVER policy, this extension will follow the Phpfastcache *MAJOR and MINOR* version but will have its own *PATCH* versions.

## Reporting a Vulnerability
If you discover any security vulnerability contact me at contact#at#geolim4.com with a subject formatted like that:\
`[PHPFASTCACHE][VULNERABILITY] Your mail subject goes here`

Thanks in advance for taking the time to report me that in private.
61 changes: 61 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "phpfastcache/solr-extension",
"type" : "phpfastcache-extension",
"description": "Phpfastcache Solr extension",
"keywords": ["cache", "phpfastcache", "solr", "solarium"],
"homepage": "https://github.com/PHPSocialNetwork/solr-extension",
"license": "MIT",
"readme": "README.md",
"minimum-stability": "beta",
"authors": [
{
"name": "Georges.L",
"email": "[email protected]",
"homepage": "https://github.com/Geolim4",
"role": "Project Manager"
}
],
"require": {
"php": ">=8.0",
"phpfastcache/phpfastcache": "^9.2",
"solarium/solarium": "~6.1"
},
"require-dev": {
"phpmd/phpmd": "@stable",
"squizlabs/php_codesniffer": "@stable",
"phpstan/phpstan": "^1.5",
"jetbrains/phpstorm-stubs": "dev-master",
"phpfastcache/phpfastcache-devtools": "^9.2"
},
"autoload": {
"psr-4": {
"Phpfastcache\\Extensions\\": "lib/Phpfastcache/Extensions"
},
"files": [
"lib/ExtensionRegister.php"
]
},
"scripts": {
"phpcs": "vendor/bin/phpcs lib/ --report=summary",
"phpcbf": "vendor/bin/phpcbf lib/ --report=summary",
"phpmd": "vendor/bin/phpmd lib/ ansi phpmd.xml",
"phpstan": "vendor/bin/phpstan analyse lib/ -l 6 -c phpstan.neon",
"quality": ["@phpcs", "@phpmd", "@phpstan"],
"tests": [
"php tests/Solr.test.php"
]
},
"support": {
"issues": "https://github.com/PHPSocialNetwork/phpfastcache/issues",
"wiki": "https://github.com/PHPSocialNetwork/phpfastcache/wiki",
"docs": "https://github.com/PHPSocialNetwork/phpfastcache/wiki",
"source": "https://github.com/PHPSocialNetwork/phpfastcache",
"security": "https://github.com/PHPSocialNetwork/phpfastcache/blob/master/SECURITY.md"
},
"funding": [
{
"type": "patreon",
"url": "https://www.patreon.com/geolim4"
}
]
}
15 changes: 15 additions & 0 deletions lib/ExtensionRegister.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace Phpfastcache;

use Phpfastcache\Extensions\Drivers\Solr\{Config, Driver, Event, Item};

// Semver Compatibility until v10
class_alias(Config::class, Drivers\Solr\Config::class);
class_alias(Driver::class, Drivers\Solr\Driver::class);
class_alias(Event::class, Drivers\Solr\Event::class);
class_alias(Item::class, Drivers\Solr\Item::class);

ExtensionManager::registerExtension('Solr', Driver::class);
Loading

0 comments on commit 20bb0cd

Please sign in to comment.