Skip to content

Commit 4b1918f

Browse files
authored
Merge pull request #43 from dotkernel/issue-42
Issue #42: Remove PHP 8.1 and add PHP 8.4 & 8.5 support
2 parents 18575eb + f2f9823 commit 4b1918f

36 files changed

Lines changed: 218 additions & 337 deletions

.github/workflows/codecov.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ jobs:
1515
- ubuntu-latest
1616

1717
php:
18-
- "8.1"
1918
- "8.2"
2019
- "8.3"
20+
- "8.4"
21+
- "8.5"
2122

2223
steps:
2324
- name: Checkout

.github/workflows/docs-build.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
on:
2+
- push
3+
4+
name: Run PHPStan checks
5+
6+
jobs:
7+
mutation:
8+
name: PHPStan ${{ matrix.php }}-${{ matrix.os }}
9+
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
17+
php:
18+
- "8.2"
19+
- "8.3"
20+
- "8.4"
21+
- "8.5"
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Install PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: "${{ matrix.php }}"
31+
coverage: pcov
32+
ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
33+
tools: composer:v2, cs2pr
34+
35+
- name: Determine composer cache directory
36+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
37+
38+
- name: Cache dependencies installed with composer
39+
uses: actions/cache@v4
40+
with:
41+
path: ${{ env.COMPOSER_CACHE_DIR }}
42+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
43+
restore-keys: |
44+
php${{ matrix.php }}-composer-
45+
46+
- name: Install dependencies with composer
47+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
48+
49+
- name: Run static analysis with PHPStan
50+
run: vendor/bin/phpstan analyse

README.md

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# dot-navigation
22

33
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-navigation)
4-
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-navigation/3.5.1)
4+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-navigation/3.6.0)
55

66
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-navigation)](https://github.com/dotkernel/dot-navigation/issues)
77
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-navigation)](https://github.com/dotkernel/dot-navigation/network)
@@ -10,21 +10,21 @@
1010

1111
[![Build Static](https://github.com/dotkernel/dot-navigation/actions/workflows/static-analysis.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-navigation/actions/workflows/static-analysis.yml)
1212
[![codecov](https://codecov.io/gh/dotkernel/dot-navigation/graph/badge.svg?token=AI9WFYDDX9)](https://codecov.io/gh/dotkernel/dot-navigation)
13+
[![PHPStan](https://github.com/dotkernel/dot-navigation/actions/workflows/static-analysis.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-navigation/actions/workflows/static-analysis.yml)
1314

14-
[![SymfonyInsight](https://insight.symfony.com/projects/68b7c728-4cc9-40ac-a3be-cf17f9b2eaf1/big.svg)](https://insight.symfony.com/projects/68b7c728-4cc9-40ac-a3be-cf17f9b2eaf1)
15-
16-
Allows you to easily define and parse menus inside templates, configuration based approach.
15+
Allows you to easily define and parse menus inside templates, configuration-based approach.
1716

1817
## Installation
1918

20-
Run
19+
Run the following Composer command:
2120

22-
composer require dotkernel/dot-navigation
21+
```shell
22+
composer require dotkernel/dot-navigation
23+
```
2324

2425
Merge `ConfigProvider` to your application's configuration.
2526

26-
The package uses dot-helpers package, please merge dot-helpers `ConfigProvider` to your application's configuration
27-
also, if it's not merged already!
27+
The package uses dot-helpers package, please merge dot-helpers `ConfigProvider` to your application's configuration also, if it's not merged already.
2828

2929
Register `NavigationMiddleware` in your middleware pipe between the routing and the dispatching middleware.
3030

@@ -34,42 +34,52 @@ Locate dot-navigation's distributable config file `vendor/dotkernel/dot-navigati
3434

3535
## Components
3636

37-
A menu, or navigation container, is a class implementing the \RecursiveIterator interface. It has a hierarchical structure, with nodes called pages(see the `Page` class) that may have children. It is basically a tree
37+
A menu, or navigation container, is a class implementing the \RecursiveIterator interface.
38+
It has a hierarchical structure, with nodes called pages (see the `Page` class) that may have children.
39+
It is basically a tree.
3840

39-
A Page extends the NavigationContainer class. The NavigationContainer is the top most node which represents the entire menu. The children of this node are Page instances that defines each navigation item.
41+
A Page extends the NavigationContainer class.
42+
The NavigationContainer is the top most node which represents the entire menu.
43+
The children of this node are Page instances that define each navigation item.
4044

41-
A page has a reference to its parent, and can have options and attributes. There are no limitation on what is accepted as options or attributes.
45+
A page has a reference to its parent and can have options and attributes.
46+
There is no limitation on what is accepted as options or attributes.
4247

43-
Options can be any piece of information that describes a page. Some predefined options exists, in order for the navigation module to work seamlessly with other dot modules.
48+
Options can be any piece of information that describes a page.
49+
Some predefined options exist in order for the navigation module to work seamlessly with other dot modules.
4450

45-
Attributes are key value pairs that defines the menu item. They are usually inserted as html attributes when parsing the menu, but of course, this is implementation specific.
51+
Attributes are key value pairs that define the menu item.
52+
They are usually inserted as HTML attributes when parsing the menu, but of course, this is implementation-specific.
4653

47-
A `NavigationService` class, is the service that handles all defined menu container. It can fetch the container from its provider, check if a page is active or not and get the page's generated URI.
54+
A `NavigationService` class, is the service that handles all defined menu containers.
55+
It can fetch the container from its provider, check if a page is active or not, and get the page's generated URI.
4856

4957
## Container providers
5058

51-
Each menu can be created from different sources. The responsibility of creating a menu container from the source falls on a container provider.
59+
Each menu can be created from different sources.
60+
The responsibility of creating a menu container from the source falls on a container provider.
5261

5362
Each provider must implement the interface `ProviderInterface` and be registered in the ProviderPluginManager.
5463

5564
We offer just one provider for now, `ArrayProvider`, that is able to fetch and create a menu container from a php array that is defined in the configuration file.
5665

5766
## NavigationRenderer
5867

59-
Used to render the navigation container in a displayable format. It can render a simple HTML ul list or use a partial template, to render the menu in a template engine.
68+
Used to render the navigation container in a displayable format.
69+
It can render a simple HTML ul list or use a partial template to render the menu in a template engine.
6070

6171
The partial method is usually the more flexible one, custom rules can be defined and checked in the template.
6272

63-
If you are using twig, there is already a twig extension provided in package dot-twigrenderer, that you can use to easily parse the menus inside your templates
73+
If you are using twig, there is already a twig extension provided in package `dotkerel/dot-twigrenderer`, that you can use to easily parse the menus inside your templates.
6474

65-
When using the partial method, the template will receive as parameters the container, the navigation service and any extra parameters set by the developer.
75+
When using the partial method, the template will receive as parameters the container, the navigation service, and any extra parameters set by the developer.
6676

67-
Navigation containers are referred, when parsed, by their name, as defined in the configuration file.
77+
Navigation containers are referred to, when parsed, by their name, as defined in the configuration file.
6878

6979
## Required page options and attributes
7080

7181
The following are options that each page should define in the configuration
7282

7383
* `label` - the text of the menu item
7484
* `route` or `uri` - defines the route or link the menu item will have
75-
* `permission` - can be used optionally, if authorization service is present, in order to omit menu items that are not authorized to visit.
85+
* `permission` - can be used optionally if authorization service is present, to omit menu items that are not authorized to visit.

SECURITY.md

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,28 @@
22

33
## Supported Versions
44

5-
6-
| Version | Supported | PHP Version |
7-
|---------|--------------------|---------------------------------------------------------------------------------------------------------------|
8-
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-navigation/3.4.2)|
9-
5+
| Version | Supported | PHP Version |
6+
|---------|--------------------|----------------------------------------------------------------------------------------------------------------|
7+
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-navigation/3.6.0) |
8+
| <= 2.x | :x: | |
109

1110
## Reporting Potential Security Issues
1211

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

1715
When reporting issues, please provide the following information:
1816

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

23-
We request that you contact us via the email address above and give the
24-
project contributors a chance to resolve the vulnerability and issue a new
25-
release prior to any public exposure; this helps protect the project's
26-
users, and provides them with a chance to upgrade and/or update in order to
27-
protect their applications.
28-
21+
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;
22+
this helps protect the project's users and provides them with a chance to upgrade and/or update to protect their applications.
2923

3024
## Policy
3125

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

34-
- We will patch the current release branch, as well as the immediate prior minor
35-
release branch.
36-
37-
- After patching the release branches, we will immediately issue new security
38-
fix releases for each patched release branch.
39-
28+
- We will patch the current release branch, as well as the immediate prior minor release branch.
29+
- After patching the release branches, we will immediately issue new security fix releases for each patched release branch.

composer.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dotkernel/dot-navigation",
33
"type": "library",
4-
"description": "DotKernel navigation component",
4+
"description": "Dotkernel navigation component",
55
"license": "MIT",
66
"homepage": "https://github.com/dotkernel/dot-navigation",
77
"keywords": [
@@ -13,7 +13,7 @@
1313
],
1414
"authors": [
1515
{
16-
"name": "DotKernel Team",
16+
"name": "Dotkernel Team",
1717
"email": "team@dotkernel.com"
1818
}
1919
],
@@ -24,7 +24,7 @@
2424
}
2525
},
2626
"require": {
27-
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
27+
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
2828
"dotkernel/dot-authorization": "^3.4.1",
2929
"dotkernel/dot-helpers": "^3.5.1",
3030
"laminas/laminas-escaper": "^2.13.0",
@@ -34,9 +34,10 @@
3434
"psr/http-server-middleware": "^1.0.2"
3535
},
3636
"require-dev": {
37-
"laminas/laminas-coding-standard": "^2.5.0",
38-
"phpunit/phpunit": "^10.4.2",
39-
"vimeo/psalm": "^5.16.0"
37+
"laminas/laminas-coding-standard": "^3.0.0",
38+
"phpstan/phpstan": "^2.1",
39+
"phpstan/phpstan-phpunit": "^2.0",
40+
"phpunit/phpunit": "^10.4.2"
4041
},
4142
"autoload": {
4243
"psr-4": {
@@ -51,12 +52,12 @@
5152
"scripts": {
5253
"check": [
5354
"@cs-check",
54-
"@test"
55+
"@test",
56+
"@static-analysis"
5557
],
5658
"cs-check": "phpcs",
5759
"cs-fix": "phpcbf",
58-
"test": "phpunit --colors=always",
59-
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
60-
"static-analysis": "psalm --shepherd --stats"
60+
"static-analysis": "phpstan analyse --memory-limit 1G",
61+
"test": "phpunit --colors=always"
6162
}
6263
}

docs/book/index.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/book/v3/components.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/book/v3/configuration.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/book/v3/container-providers.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)