Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed May 30, 2016
0 parents commit 645f5e9
Show file tree
Hide file tree
Showing 8 changed files with 490 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
.idea
vendor
.puli
composer.lock
build
13 changes: 13 additions & 0 deletions .travis.yml
@@ -0,0 +1,13 @@
language: php

php:
- 7.0

before_script:
- composer install --no-interaction

script:
- phpunit

after_script:
- php vendor/bin/coveralls -v
61 changes: 61 additions & 0 deletions README.md
@@ -0,0 +1,61 @@
[![Build Status](https://travis-ci.org/thecodingmachine/psr-6-doctrine-bridge-universal-module.svg?branch=1.0)](https://travis-ci.org/thecodingmachine/psr-6-doctrine-bridge-universal-module)
[![Coverage Status](https://coveralls.io/repos/thecodingmachine/psr-6-doctrine-bridge-universal-module/badge.svg?branch=1.0&service=github)](https://coveralls.io/github/thecodingmachine/psr-6-doctrine-bridge-universal-module?branch=1.0)


# PSR6 to Doctrine cache universal module

This package integrates [cache/psr-6-doctrine-bridge](https://github.com/php-cache/doctrine-bridge) (the bridge between Doctrine cache and PSR-6) in any [container-interop/service-provider](https://github.com/container-interop/service-provider) compatible framework/container.

## Installation

```
composer require thecodingmachine/psr-6-doctrine-bridge-universal-module
```

Once installed, you need to register the [`TheCodingMachine\DoctrineCacheBridgeServiceProvider`](src/DoctrineCacheBridgeServiceProvider.php) into your container.

If your container supports Puli integration, you have nothing to do. Otherwise, refer to your framework or container's documentation to learn how to register *service providers*.

## Introduction

This service provider will provide a default Doctrine cache implementation based on the already configured PSR-6 cache.

It assumes there is already a configured service providing a PSR-6 cache pool. You can install a service provider providing this service using:


```
composer require thecodingmachine/stash-universal-module
```

(this will install Stash and its related service-provider. Stash is a PSR-6 caching library)

### Usage

```php
use Doctrine\Common\Cache\CacheProvider;

$cachePool = $container->get(CacheProvider::class);
echo $cachePool->get('my_cached_value');
```

## Expected values / services

This *service provider* expects the following configuration / services to be available:

| Name | Compulsory | Description |
|-----------------|------------|----------------------------------------|
| `CacheItemPoolInterface::class` (or `CacheItemPoolInterface::class.[suffix]`) | A PSR-6 compatible cache pool. |


## Provided services

This *service provider* provides the following services:

| Service name | Description |
|-----------------------------|--------------------------------------|
| `Doctrine\Common\Cache\CacheProvider` | A Doctrine cache, this is actually a bridge to the PSR-6 pool. |
| `Doctrine\Common\Cache\Cache` | An alias to the `CacheProvider`. |

## Extended services

This *service provider* does not extend any service.
27 changes: 27 additions & 0 deletions composer.json
@@ -0,0 +1,27 @@
{
"name": "thecodingmachine/psr-6-doctrine-bridge-universal-module",
"description": "Cross-framework module for cache/psr-6-doctrine-bridge",
"license": "MIT",
"type": "library",
"autoload": {
"psr-4": {
"TheCodingMachine\\": "src/"
}
},
"require": {
"php": ">=7.0",
"container-interop/service-provider": "~0.3.0",
"thecodingmachine/common-factories": "dev-master",
"cache/psr-6-doctrine-bridge": "^2.1"
},
"require-dev": {
"puli/cli":"^1.0",
"puli/composer-plugin": "^1.0",
"mnapoli/simplex": "~0.2.0",
"phpunit/phpunit": "^5.0",
"satooshi/php-coveralls": "^1.0",
"thecodingmachine/stash-universal-module": "^1.0"
},
"minimum-stability": "dev",
"prefer-stable": true
}
28 changes: 28 additions & 0 deletions phpunit.xml.dist
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Main test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>

0 comments on commit 645f5e9

Please sign in to comment.