Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .editorconfig

This file was deleted.

51 changes: 32 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
name: test

on:
push:
pull_request:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Pull
run: docker-compose pull --quiet
- name: Build
run: docker-compose build
- name: Test
run: docker-compose run lib composer ci
- name: Upload coverage
uses: codecov/codecov-action@v1.3.2
if: success()
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/clover.xml
test:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
php-version:
- '7.4'
- '8.0'

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Pull
run: docker-compose pull --quiet

- name: Build
run: docker-compose build --build-arg PHPVERSION=${{ matrix.php-version }}

- name: Test
run: docker-compose run lib composer ci

- name: Upload coverage
uses: codecov/codecov-action@v1.3.2
if: success()
with:
file: ./coverage/clover.xml
1 change: 1 addition & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ WORKDIR /app
COPY composer.json .
COPY composer.lock .
RUN composer validate
RUN composer install --no-interaction --no-progress --no-suggest
RUN composer install --no-interaction --no-progress

COPY . .

Expand Down
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Session::useCurrentRedisDriver($redis);
Session::set('key', 'value');
$value = Session::get('key');
```
With your own driver implementing SessionHandlerInterface
With your own driver implementing `SessionHandlerInterface` and/or `SessionUpdateTimestampHandlerInterface`
```php
$driver = new MyCustomDriver();
Session::useCustomDriver($driver);
Expand Down Expand Up @@ -147,28 +147,72 @@ When flash data is restore, it will be delete in $_SESSION.
#### Static PHP Session Default Driver
* useDefaultDriver(): void
* useDefaultEncryptionDriver(key: string, [method: string|null = null]): void
* setLengthSessionID(length: int): void
* getLengthSessionID(): int

#### Static File Driver
* useFileDriver(): void
* useFileEncryptionDriver(key: string, [method: string|null = null]): void
* setPrefixForFile(prefix: string): void
* setLengthSessionID(length: int): void
* getLengthSessionID(): int

#### Static Database Driver
* useNewDatabaseDriver(configuration: \Rancoud\Database\Configurator|array): void
* useCurrentDatabaseDriver(databaseInstance: \Rancoud\Database\Database): void
* useNewDatabaseEncryptionDriver(configuration: \Rancoud\Database\Configurator|array, key: string, [method: string = null]): void
* useCurrentDatabaseEncryptionDriver(databaseInstance: \Rancoud\Database\Database, key: string, [method: string = null]): void
* setUserIdForDatabase(userId: int): void
* setLengthSessionID(length: int): void
* getLengthSessionID(): int

#### Static Redis Driver
* useNewRedisDriver(configuration: array|string): void
* useCurrentRedisDriver(redisInstance: \Predis\Client): void
* useNewRedisEncryptionDriver(configuration: array|string, key: string, [method: string = null]): void
* useCurrentRedisEncryptionDriver(redisInstance: \Predis\Client, key: string, [method: string = null]): void
* setLengthSessionID(length: int): void
* getLengthSessionID(): int

#### Static Custom Driver
* useCustomDriver(customDriver: \SessionHandlerInterface): void

## Session options
List of session options you can change:
* save_path
* name
* save_handler
* auto_start
* gc_probability
* gc_divisor
* gc_maxlifetime
* serialize_handler
* cookie_lifetime
* cookie_path
* cookie_domain
* cookie_secure
* cookie_httponly
* cookie_samesite
* use_strict_mode
* use_cookies
* use_only_cookies
* referer_check
* cache_limiter
* cache_expire
* use_trans_sid
* trans_sid_tags
* trans_sid_hosts
* sid_length
* sid_bits_per_character
* upload_progress.enabled
* upload_progress.cleanup
* upload_progress.prefix
* upload_progress.name
* upload_progress.freq
* upload_progress.min_freq
* lazy_write
* read_and_close

## Driver Informations
### Default
Use SessionHandler
Expand Down
11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@
"Rancoud\\Session\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"tests\\": "tests"
}
},
"require": {
"php": ">=7.4.0",
"ext-openssl": ">=7.4.0"
"ext-openssl": "*",
"ext-session": "*",
"ext-mbstring": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
Expand All @@ -36,7 +43,7 @@
"php-cs-fixer fix"
],
"test": [
"phpdbg -qrr vendor/bin/phpunit --colors --coverage-text --coverage-clover ./coverage/clover.xml"
"phpdbg -qrr vendor/bin/phpunit --colors --coverage-html ./coverage --coverage-text --coverage-clover ./coverage/clover.xml"
]
}
}
37 changes: 22 additions & 15 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<arg value="p"/>

<file>src</file>
<file>tests</file>

<rule ref="PSR2"/>

Expand Down
Loading