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
4 changes: 2 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
- ubuntu-latest

php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
- ubuntu-latest

php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
3 changes: 3 additions & 0 deletions .laminas-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"backwardCompatibilityCheck": true
}
2 changes: 1 addition & 1 deletion OSSMETADATA
Original file line number Diff line number Diff line change
@@ -1 +1 @@
osslifecycle=active
osslifecycle=active
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Documentation is available at: https://docs.dotkernel.org/dot-twigrenderer/.
## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-twigrenderer)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-twigrenderer/3.6.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-twigrenderer/3.7.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-twigrenderer)](https://github.com/dotkernel/dot-twigrenderer/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-twigrenderer)](https://github.com/dotkernel/dot-twigrenderer/network)
Expand Down
25 changes: 7 additions & 18 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,28 @@

## Supported Versions


| Version | Supported | PHP Version |
|---------|--------------------|------------------------------------------------------------------------------------------------------------------|
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-twigrenderer/3.4.3) |
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-twigrenderer/3.7.0) |
| <= 2.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.
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.

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

- 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.
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
}
],
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"laminas/laminas-servicemanager": "^3.22.1",
"mezzio/mezzio-twigrenderer": "^2.15",
"laminas/laminas-view": "^2.33",
"laminas/laminas-authentication": "^2.16",
"dotkernel/dot-navigation": "^3.5.1",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"dotkernel/dot-authorization": "^3.4.1",
"dotkernel/dot-flashmessenger": "^3.4.2",
"dotkernel/dot-navigation": "^3.5.1",
"laminas/laminas-authentication": "^2.16",
"laminas/laminas-form": "^3.19.1",
"dotkernel/dot-authorization": "^3.4.1"
"laminas/laminas-view": "^2.33",
"laminas/laminas-servicemanager": "^3.22.1",
"mezzio/mezzio-twigrenderer": "^2.15"
},
"require-dev": {
"laminas/laminas-coding-standard": "^3.0",
Expand Down
4 changes: 3 additions & 1 deletion docs/book/v3/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

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

\Dot\Twig\ConfigProvider::class,
```php
Dot\Twig\ConfigProvider::class,
```
18 changes: 10 additions & 8 deletions docs/book/v3/examples/example-date-ext.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Using the date extension

Dot-twigrenderer extends Twig with a function that calculates the difference between two dates. The function converts dates to a time ago string like Facebook and Twitter has. If `null` is passed as the second or third parameters, the current time will be used.
Dot-twigrenderer extends Twig with a function that calculates the difference between two dates.
The function converts dates to a time ago string like Facebook and Twitter has.
If `null` is passed as the second or third parameters, the current time will be used.

```php
public function diff(
Environment $env,
string|DateTimeInterface|null $date,
string|DateTimeZone|null $now = null
): string;
Environment $env,
string|DateTimeInterface|null $date,
string|DateTimeZone|null $now = null,
): string;
```

## Example usage
Expand All @@ -19,9 +21,9 @@ $loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../../templates/page');
$twigEnv = new \Twig\Environment($loader);

$this->template->render('page::templateName', [
"env" => $twigEnv,
#other parameters
]);
'env' => $twigEnv,
#other parameters
]);
```

This enables the use of the `diff` function:
Expand Down
19 changes: 10 additions & 9 deletions docs/book/v3/examples/example-flash-messenger-ext.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ Dot-twigrenderer extends Twig with functions that use functionality from [dotker

```php
public function renderMessages(
?string $type = null,
string $channel = FlashMessengerInterface::DEFAULT_CHANNEL
): string; // empty response
?string $type = null,
string $channel = FlashMessengerInterface::DEFAULT_CHANNEL
): string; // empty response

public function function renderMessagesPartial(
string $partial,
array $params = [],
?string $type = null,
string $channel = FlashMessengerInterface::DEFAULT_CHANNEL
): string;
string $partial,
array $params = [],
?string $type = null,
string $channel = FlashMessengerInterface::DEFAULT_CHANNEL
): string;
```

`renderMessagesPartial` returns messages previously passed to `dot-flashMessenger`. The last 3 parameters can be omitted to list all messages sent to FlashMessenger.
`renderMessagesPartial` returns messages previously passed to `dot-flashMessenger`.
The last three parameters can be omitted to list all messages sent to FlashMessenger.

* `$partial` is the template file name
* `$params` is an optional array of items (key-value) passed to the template file
Expand Down
2 changes: 1 addition & 1 deletion docs/book/v3/examples/example-form-elements-ext.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using the form elements extension

Dot-twigrenderer extends Twig with a function based on `TwigTest` that checks if each `Form` element is an instance of its class.
DotTwigrenderer extends Twig with a function based on `TwigTest` that checks if each `Form` element is an instance of its class.

```php
public function getTests(): array;
Expand Down
10 changes: 5 additions & 5 deletions docs/book/v3/examples/example-navigation-ext.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Dot-twigrenderer extends Twig with functions that use functionality from [dotker
```php
public function htmlAttributes(Page $page): string;

public function renderMenu(NavigationContainer|string $container): string; //incomplete?
public function renderMenu(NavigationContainer|string $container): string;

public function renderMenuPartial(
NavigationContainer|string $container,
string $partial,
array $params = []
): string;
NavigationContainer|string $container,
string $partial,
array $params = []
): string;
```

* `$partial` is the template file name
Expand Down
11 changes: 6 additions & 5 deletions docs/book/v3/examples/example-translation-ext.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Using the translation extension

Dot-twigrenderer extends Twig with a filter called `trans` that parses translations in singular and plural forms.
DotTwigrenderer extends Twig with a filter called `trans` that parses translations in singular and plural forms.

The `local.php.dist` file in [frontend](https://github.com/dotkernel/frontend/blob/4.0/config/autoload/local.php.dist) provides an example for working with multiple languages. The `translator` variable can be expanded to other languages using [Poedit](https://poedit.net/) which can edit `.po` files like the example in `data/language/da_DK/LC_MESSAGES/messages.po`. The compiled file will have the extension `.mo`
The `local.php.dist` file in [frontend](https://github.com/dotkernel/frontend/blob/4.0/config/autoload/local.php.dist) provides an example for working with multiple languages.
The `translator` variable can be expanded to other languages using [Poedit](https://poedit.net/) which can edit `.po` files like the example in `data/language/da_DK/LC_MESSAGES/messages.po`.
The compiled file will have the extension `.mo`.

To apply the translations

- the Twig templates need either `{% trans 'translateText' %}` or `{{ translateText|trans }}`
- then the js file needs `translateText("translateText")`
- then the JavaScript file needs `translateText("translateText")`

**NOTE:**
In order to have a proper behaviour of language selector, you need the language pack installed at the Operating System level.
> To have a proper behavior of language selector, you need the language pack installed at the Operating System level.

`dnf install glibc-all-langpacks`

Expand Down
4 changes: 3 additions & 1 deletion docs/book/v3/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

Run the following command in your project folder

composer require dotkernel/dot-twigrenderer
```shell
composer require dotkernel/dot-twigrenderer
```
2 changes: 1 addition & 1 deletion docs/book/v3/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Dotkernel component providing Twig extensions and customizations.
## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-twigrenderer)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-twigrenderer/3.6.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-twigrenderer/3.7.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-twigrenderer)](https://github.com/dotkernel/dot-twigrenderer/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-twigrenderer)](https://github.com/dotkernel/dot-twigrenderer/network)
Expand Down
15 changes: 2 additions & 13 deletions docs/book/v3/usage/factory.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Method #1 - Factory
# 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(
Expand All @@ -19,7 +17,6 @@ class ExampleFactory
## Step 2: Access through your Service

```php

class ExampleService
{
private TemplateRendererInterface $template;
Expand All @@ -28,8 +25,6 @@ class ExampleService
{
$this->template = $template;
}

//your methods
}
```

Expand All @@ -39,15 +34,9 @@ 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.
See the below example for a better understanding of the file structure.

```php
<?php

declare(strict_types=1);

namespace YourApp;

class ConfigProvider
{
public function __invoke(): array
Expand Down
6 changes: 3 additions & 3 deletions docs/book/v3/usage/injection.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Method #2 - Injection
# Method #2: Injection

If you are using [dot-annotated-services](https://github.com/dotkernel/dot-annotated-services/) in your project, you don't need to create a separate factory, just follow the below steps.
If you are using [dot-annotated-services](https://github.com/dotkernel/dot-annotated-services/) in your project, you don't need to create a separate factory, follow the below steps.

## Step 1: Access through your Service

Expand All @@ -9,7 +9,7 @@ If you are using [dot-annotated-services](https://github.com/dotkernel/dot-annot
class ExampleService
{
private TemplateRendererInterface $template;

/**
* @Dot\AnnotatedServices\Annotation\Inject({
* TemplateRendererInterface::class,
Expand Down
Loading