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
11 changes: 11 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Continuous Integration"

on:
pull_request:
push:
branches:
tags:

jobs:
ci:
uses: laminas/workflow-continuous-integration/.github/workflows/continuous-integration.yml@1.x
47 changes: 0 additions & 47 deletions .github/workflows/cs-tests.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: docs-build

on:
release:
types: [published]
workflow_dispatch:

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Build Docs
uses: dotkernel/documentation-theme/github-actions/docs@main
env:
DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47 changes: 0 additions & 47 deletions .github/workflows/static-analysis.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/unit-tests.yml

This file was deleted.

20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,41 @@
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-session)](https://github.com/dotkernel/dot-session/stargazers)
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-session)](https://github.com/dotkernel/dot-session/blob/5.0/LICENSE.md)

[![Build Static](https://github.com/dotkernel/dot-session/actions/workflows/static-analysis.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/dot-session/actions/workflows/static-analysis.yml)
[![Build Static](https://github.com/dotkernel/dot-session/actions/workflows/continuous-integration.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/dot-session/actions/workflows/continuous-integration.yml)
[![codecov](https://codecov.io/gh/dotkernel/dot-session/graph/badge.svg?token=DCHKH0R4AA)](https://codecov.io/gh/dotkernel/dot-session)

[![SymfonyInsight](https://insight.symfony.com/projects/f6038340-d76b-4da8-9016-0472d4899f0a/big.svg)](https://insight.symfony.com/projects/f6038340-d76b-4da8-9016-0472d4899f0a)


DotKernel session component extending and customizing [laminas-session](https://github.com/laminas/laminas-session)

## Installation

Run the following command in your project folder

```bash
composer require dotkernel/dot-session

```

## Configuration

Register `SessionMiddleware` in your application's pipeline by adding the following line to `config/pipeline.php`:

```php
$app->pipe(Dot\Session\SessionMiddleware::class);

```

Register `dot-session`'s ConfigProvider in your application's configurations by adding the following line to `config/config.php`:

```php
\Dot\Session\ConfigProvider::class,

```

## Usage

Basic usage to access and use the session object in your services:

### Method #1 - Factory

#### Step 1: Create a factory that retrieves the SessionManger from the container

```php
Expand Down Expand Up @@ -69,11 +74,12 @@ class ExampleService
$this->session = $session;
}

//you methods
//your methods
}
```

### Method 2 - Injection
### Method #2 - Injection

If you use annotated injection you can inject the Session Manager in your services.

```php
Expand Down
36 changes: 36 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Security Policy

## Supported Versions

| Version | Supported | PHP Version |
|---------|--------------------|-------------------------------------------------------------------------------------------------------------|
| 5.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-session/5.4.2) |
| <= 4.x | :x: | |

## Reporting Potential Security Issues

If you have encountered a potential security vulnerability in this project,
please report it to us at <security@dotkernel.com>. We will work with you to
verify the vulnerability and patch it.

When reporting issues, please provide the following information:

- Component(s) affected
- A description indicating how to reproduce the issue
- A summary of the security vulnerability and impact

We request that you contact us via the email address above and give the
project contributors a chance to resolve the vulnerability and issue a new
release prior to any public exposure; this helps protect the project's
users, and provides them with a chance to upgrade and/or update in order to
protect their applications.

## Policy

If we verify a reported security vulnerability, our policy is:

- We will patch the current release branch, as well as the immediate prior minor
release branch.

- After patching the release branches, we will immediately issue new security
fix releases for each patched release branch.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"laminas/laminas-dependency-plugin": false
}
}
}
1 change: 1 addition & 0 deletions docs/book/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../README.md
9 changes: 9 additions & 0 deletions docs/book/v5/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Configuration

Register `SessionMiddleware` in your application's pipeline by adding the following line to `config/pipeline.php`:

$app->pipe(Dot\Session\SessionMiddleware::class);

Register `dot-session`'s ConfigProvider in your application's configurations by adding the following line to `config/config.php`:

\Dot\Session\ConfigProvider::class,
5 changes: 5 additions & 0 deletions docs/book/v5/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Installation

Run the following command in your project folder

composer require dotkernel/dot-session
6 changes: 6 additions & 0 deletions docs/book/v5/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Usage

Basic usage to access and use the session object in your services:

* [Method #1 - Factory](usage/factory.md)
* [Method #2 - Injection](usage/injection.md)
69 changes: 69 additions & 0 deletions docs/book/v5/usage/factory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Method #1 - Factory

## Step 1: Create a factory that retrieves the SessionManger from the container

```php
class ExampleFactory
{
// code

public function __invoke(ContainerInterface $container)
{
return new ExampleService(
$container->get(SessionManager::class)
)
}
}
```

## Step 2: Access through your Service

```php

class ExampleService
{
private SessionManager $session;

public function __construct(SessionManager $session)
{
$this->session = $session;
}

//your methods
}
```

## Step 3: Register the factory

Open the ConfigProvider of the module where your repository resides.

Add a new entry under `factories`, where the key is your service's FQCN and the value is your factory's FQCN.

See below example for a better understanding of the file structure.

```php
<?php

declare(strict_types=1);

namespace YourApp;

class ConfigProvider
{
public function __invoke(): array
{
return [
'dependencies' => $this->getDependencies(),
];
}

public function getDependencies(): array
{
return [
'factories' => [
ExampleService::class => ExampleFactory::class,
],
];
}
}
```
Loading