Skip to content

Commit

Permalink
updated docs, workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bidi47 committed Apr 5, 2024
1 parent f316e28 commit c497c1d
Show file tree
Hide file tree
Showing 15 changed files with 171 additions and 148 deletions.
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/[email protected]
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.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

[![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
Expand All @@ -22,22 +21,22 @@ Run the following command in your project folder

composer require dotkernel/dot-session


## 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,


## 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

Check failure on line 42 in README.md

View workflow job for this annotation

GitHub Actions / ci / QA Checks (README Linting [8.1, latest], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Code block style [Expected: indented; Actual: fenced]
Expand Down Expand Up @@ -69,11 +68,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

Check failure on line 79 in README.md

View workflow job for this annotation

GitHub Actions / ci / QA Checks (README Linting [8.1, latest], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Code block style [Expected: indented; Actual: fenced]
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 <[email protected]>. 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
8 changes: 8 additions & 0 deletions docs/book/v5/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Configuration

Check failure on line 1 in docs/book/v5/configuration.md

View workflow job for this annotation

GitHub Actions / ci / QA Checks (Documentation Linting [8.1, latest], ubuntu-latest, laminas/laminas-continuous-integra...

Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "# 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)
36 changes: 36 additions & 0 deletions docs/book/v5/usage/factory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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)
)
}
}
```

Register the factory in any mode you register factories on your project.

## Step 2: Access through your Service

```php

class ExampleService
{
private SessionManager $session;

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

//your methods
}
```
23 changes: 23 additions & 0 deletions docs/book/v5/usage/injection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Method #2 - Injection

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

```php
use Dot\AnnotatedServices\Annotation\Inject;
use Laminas\Session\SessionManager;

class ExampleService
{
private SessionManager $session;

/**
* @Inject({SessionManager::class})
*/
public function __construct(SessionManager $session)
{
$this->session = $session;
}

//your methods
}
```
21 changes: 21 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
docs_dir: docs/book
site_dir: docs/html
extra:
project: Packages
current_version: v5
versions:
- v5
nav:
- Home: index.md
- v5:
- Overview: v5/installation.md
- Installation: v5/configuration.md
- Usage: v5/usage.md
- Reference:
- "Inject class dependencies": v5/usage/factory.md
- "Inject entity repositories": v5/usage/injection.md
site_name: dot-session
site_description: "DotKernel's session component"
repo_url: "https://github.com/dotkernel/dot-session"
plugins:
- search

0 comments on commit c497c1d

Please sign in to comment.