From adb744db85008384411633e547d02ec4f1afc76d Mon Sep 17 00:00:00 2001 From: bidi Date: Tue, 9 Apr 2024 17:58:05 +0300 Subject: [PATCH 1/8] updated documentation --- .github/workflows/continuous-integration.yml | 11 ++++ .github/workflows/cs-tests.yml | 47 ------------- .github/workflows/docs-build.yml | 16 +++++ .github/workflows/static-analysis.yml | 47 ------------- .github/workflows/unit-tests.yml | 47 ------------- docs/book/index.md | 1 + docs/book/v3/configuration.md | 5 ++ docs/book/v3/example-authentication-ext.md | 19 ++++++ docs/book/v3/example-authorization-ext.md | 25 +++++++ docs/book/v3/example-date-ext.md | 31 +++++++++ docs/book/v3/example-flash-messenger-ext.md | 30 +++++++++ docs/book/v3/example-form-elements-ext.md | 17 +++++ docs/book/v3/example-navigation-ext.md | 18 +++++ docs/book/v3/example-translation-ext.md | 16 +++++ docs/book/v3/installation.md | 5 ++ docs/book/v3/usage.md | 6 ++ docs/book/v3/usage/factory.md | 69 ++++++++++++++++++++ docs/book/v3/usage/injection.md | 60 +++++++++++++++++ mkdocs.yml | 16 +++++ 19 files changed, 345 insertions(+), 141 deletions(-) create mode 100644 .github/workflows/continuous-integration.yml delete mode 100644 .github/workflows/cs-tests.yml create mode 100644 .github/workflows/docs-build.yml delete mode 100644 .github/workflows/static-analysis.yml delete mode 100644 .github/workflows/unit-tests.yml create mode 100644 docs/book/index.md create mode 100644 docs/book/v3/configuration.md create mode 100644 docs/book/v3/example-authentication-ext.md create mode 100644 docs/book/v3/example-authorization-ext.md create mode 100644 docs/book/v3/example-date-ext.md create mode 100644 docs/book/v3/example-flash-messenger-ext.md create mode 100644 docs/book/v3/example-form-elements-ext.md create mode 100644 docs/book/v3/example-navigation-ext.md create mode 100644 docs/book/v3/example-translation-ext.md create mode 100644 docs/book/v3/installation.md create mode 100644 docs/book/v3/usage.md create mode 100644 docs/book/v3/usage/factory.md create mode 100644 docs/book/v3/usage/injection.md create mode 100644 mkdocs.yml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..26c5802 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -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 diff --git a/.github/workflows/cs-tests.yml b/.github/workflows/cs-tests.yml deleted file mode 100644 index e8bbade..0000000 --- a/.github/workflows/cs-tests.yml +++ /dev/null @@ -1,47 +0,0 @@ -on: - - push - -name: Run phpcs checks - -jobs: - mutation: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php: - - "8.1" - - "8.2" - - "8.3" - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - tools: composer:v2, cs2pr - coverage: none - - - name: Determine composer cache directory - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Cache dependencies installed with composer - uses: actions/cache@v3 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php }}-composer- - - name: Install dependencies with composer - run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Run phpcs checks - run: vendor/bin/phpcs diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml new file mode 100644 index 0000000..1a7aa24 --- /dev/null +++ b/.github/workflows/docs-build.yml @@ -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 }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml deleted file mode 100644 index 6f7452d..0000000 --- a/.github/workflows/static-analysis.yml +++ /dev/null @@ -1,47 +0,0 @@ -on: - - push - -name: Run static analysis - -jobs: - mutation: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php: - - "8.1" - - "8.2" - - "8.3" - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - tools: composer:v2, cs2pr - coverage: none - - - name: Determine composer cache directory - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Cache dependencies installed with composer - uses: actions/cache@v3 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php }}-composer- - - name: Install dependencies with composer - run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Run static analysis - run: vendor/bin/psalm --no-cache --output-format=github --show-info=false --threads=4 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml deleted file mode 100644 index 8f6f990..0000000 --- a/.github/workflows/unit-tests.yml +++ /dev/null @@ -1,47 +0,0 @@ -on: - - push - -name: Run PHPUnit tests - -jobs: - mutation: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php: - - "8.1" - - "8.2" - - "8.3" - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - tools: composer:v2, cs2pr - coverage: none - - - name: Determine composer cache directory - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Cache dependencies installed with composer - uses: actions/cache@v3 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php }}-composer- - - name: Install dependencies with composer - run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Run PHPUnit tests - run: vendor/bin/phpunit --colors=always diff --git a/docs/book/index.md b/docs/book/index.md new file mode 100644 index 0000000..ae42a26 --- /dev/null +++ b/docs/book/index.md @@ -0,0 +1 @@ +../../README.md diff --git a/docs/book/v3/configuration.md b/docs/book/v3/configuration.md new file mode 100644 index 0000000..b78c1b5 --- /dev/null +++ b/docs/book/v3/configuration.md @@ -0,0 +1,5 @@ +# Configuration + +Register `dot-session`'s ConfigProvider in your application's configurations by adding the following line to `config/config.php`: + + \Dot\Twig\ConfigProvider::class, diff --git a/docs/book/v3/example-authentication-ext.md b/docs/book/v3/example-authentication-ext.md new file mode 100644 index 0000000..bce8239 --- /dev/null +++ b/docs/book/v3/example-authentication-ext.md @@ -0,0 +1,19 @@ +# Using the authentication extension + +Dot-twigrenderer extends Twig with functions that use functionality from [laminas/laminas-authentication](https://github.com/laminas/laminas-authentication) to check if the user is authenticated and to get the authenticated identity object respectively. + +```php +public function hasIdentity(): bool; + +public function getIdentity(): ?IdentityInterface; +``` + +## Example usage + +```twig +{% if hasIdentity() %} + + Welcome, {% getIdentity().username %}! + +{% endif %} +``` diff --git a/docs/book/v3/example-authorization-ext.md b/docs/book/v3/example-authorization-ext.md new file mode 100644 index 0000000..2a127cc --- /dev/null +++ b/docs/book/v3/example-authorization-ext.md @@ -0,0 +1,25 @@ +# Using the authentication extension + +Dot-twigrenderer extends Twig with a function that uses functionality from [dotkernel/dot-authorization](https://github.com/dotkernel/dot-authorization) to check if a logged user is authorized to access a particular resource. + +```php +public function isGranted(string $permission = ''): bool; +``` + +The function returns a boolean value of true if the logged user has access to the requested permission. + +## Example usage + +Expanding on the example from the authentication extension: + +```twig +{% if hasIdentity() %} + + Welcome, {% getIdentity().username %}! + + {% if isGranted({{ role }}) %} + {# your code #} + {% endif %} + +{% endif %} +``` diff --git a/docs/book/v3/example-date-ext.md b/docs/book/v3/example-date-ext.md new file mode 100644 index 0000000..8c66bff --- /dev/null +++ b/docs/book/v3/example-date-ext.md @@ -0,0 +1,31 @@ +# Using the date extension - not implemented!! + +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; +``` + +## Example usage + +Pass Twig's Environment to the template + +```php +$loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../../templates/page'); +$twigEnv = new \Twig\Environment($loader); + +$this->template->render('page::templateName', [ + "env" => $twigEnv, + #other parameters + ]); +``` + +This enables the use of the `diff` function: + +```twig +{{ diff(env, '2024-02-20', '2024-02-18') }} +``` diff --git a/docs/book/v3/example-flash-messenger-ext.md b/docs/book/v3/example-flash-messenger-ext.md new file mode 100644 index 0000000..c052156 --- /dev/null +++ b/docs/book/v3/example-flash-messenger-ext.md @@ -0,0 +1,30 @@ +# Using the flash messenger extension - not fully implemented!! + +Dot-twigrenderer extends Twig with functions that use functionality from [dotkernel/dot-flashMessenger](https://github.com/dotkernel/dot-flashMessenger) to list messages or partial messages. + +```php +public function renderMessages( + ?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; +``` + +`renderMessagesPartial` returns messages previously passed to `dot-flashMessenger`. The last 3 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 +* `$type` is an optional item that identifies a subkey of FlashMessenger's channel array +* `$channel` is an optional item that identifies FlashMessenger's channel + +## Example usage + +```twig +{{ renderMessagesPartial('page:partial') }} +``` diff --git a/docs/book/v3/example-form-elements-ext.md b/docs/book/v3/example-form-elements-ext.md new file mode 100644 index 0000000..57adcd3 --- /dev/null +++ b/docs/book/v3/example-form-elements-ext.md @@ -0,0 +1,17 @@ +# 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. + +```php +public function getTests(): array; +``` + +## Example usage + +```twig +{% if false not in getTests() %} + + {# your code #} + +{% endif %} +``` diff --git a/docs/book/v3/example-navigation-ext.md b/docs/book/v3/example-navigation-ext.md new file mode 100644 index 0000000..78498be --- /dev/null +++ b/docs/book/v3/example-navigation-ext.md @@ -0,0 +1,18 @@ +# Using the form elements extension + +Dot-twigrenderer extends Twig with functions that use functionality from [dotkernel/dot-navigation](https://github.com/dotkernel/dot-navigation) to easily parse a menu and to display escaped HTML inside a template. + +```php +public function htmlAttributes(Page $page): string; + +public function renderMenu(NavigationContainer|string $container): string; //incomplete? + +public function renderMenuPartial( + NavigationContainer|string $container, + string $partial, + array $params = [] + ): string; +``` + +* `$partial` is the template file name +* `$params` is an optional array of items (key-value) passed to the template file diff --git a/docs/book/v3/example-translation-ext.md b/docs/book/v3/example-translation-ext.md new file mode 100644 index 0000000..143db0a --- /dev/null +++ b/docs/book/v3/example-translation-ext.md @@ -0,0 +1,16 @@ +# Using the form elements extension + +Dot-twigrenderer 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` + +To apply the translations +- the twig templates need either `{% trans 'translateText' %}` or `{{ translateText|trans }}` +- then the js 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. + +`dnf install glibc-all-langpacks` + +Then restart PHP-FPM. diff --git a/docs/book/v3/installation.md b/docs/book/v3/installation.md new file mode 100644 index 0000000..30c27d9 --- /dev/null +++ b/docs/book/v3/installation.md @@ -0,0 +1,5 @@ +# Installation + +Run the following command in your project folder + + composer require dotkernel/dot-twigrenderer diff --git a/docs/book/v3/usage.md b/docs/book/v3/usage.md new file mode 100644 index 0000000..740e550 --- /dev/null +++ b/docs/book/v3/usage.md @@ -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) diff --git a/docs/book/v3/usage/factory.md b/docs/book/v3/usage/factory.md new file mode 100644 index 0000000..b37da4f --- /dev/null +++ b/docs/book/v3/usage/factory.md @@ -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(TemplateRendererInterface::class) + ) + } +} +``` + +## Step 2: Access through your Service + +```php + +class ExampleService +{ + private TemplateRendererInterface $template; + + public function __construct(TemplateRendererInterface $template) + { + $this->template = $template; + } + + //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 + $this->getDependencies(), + ]; + } + + public function getDependencies(): array + { + return [ + 'factories' => [ + ExampleService::class => ExampleFactory::class, + ], + ]; + } +} +``` diff --git a/docs/book/v3/usage/injection.md b/docs/book/v3/usage/injection.md new file mode 100644 index 0000000..c122281 --- /dev/null +++ b/docs/book/v3/usage/injection.md @@ -0,0 +1,60 @@ +# 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. + +## Step 1: Access through your Service + +```php + +class ExampleService +{ + private TemplateRendererInterface $template; + + /** + * @Dot\AnnotatedServices\Annotation\Inject({ + * TemplateRendererInterface::class, + * }) + */ + public function __construct(TemplateRendererInterface $template) + { + $this->template = $template; + } + + //your methods +} +``` + +## Step 2: Register your service + +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 `Dot\AnnotatedServices\Factory\AbstractAnnotatedFactory`. + +See below example for a better understanding of the file structure. + +```php + $this->getDependencies(), + ]; + } + + public function getDependencies(): array + { + return [ + 'factories' => [ + ExampleService::class => AbstractAnnotatedFactory::class, + ], + ]; + } +} +``` diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..3450761 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,16 @@ +docs_dir: docs/book +site_dir: docs/html +extra: + project: Packages + current_version: v3 + versions: + - v3 +nav: + - Home: index.md + - v3: + - "Adding The Config Provider": v3/addingConfigProvider.md +site_name: dot-log +site_description: "DotKernel log component extending and customizing" +repo_url: "https://github.com/dotkernel/dot-log" +plugins: + - search From ed551b7da2d1325dd0ed7716d6152568610221bb Mon Sep 17 00:00:00 2001 From: bidi Date: Tue, 9 Apr 2024 18:01:21 +0300 Subject: [PATCH 2/8] updated documentation --- docs/book/v3/example-date-ext.md | 2 +- docs/book/v3/example-flash-messenger-ext.md | 2 +- docs/book/v3/example-translation-ext.md | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/book/v3/example-date-ext.md b/docs/book/v3/example-date-ext.md index 8c66bff..f68988b 100644 --- a/docs/book/v3/example-date-ext.md +++ b/docs/book/v3/example-date-ext.md @@ -1,4 +1,4 @@ -# Using the date extension - not implemented!! +# Using the date extension - not implemented! 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. diff --git a/docs/book/v3/example-flash-messenger-ext.md b/docs/book/v3/example-flash-messenger-ext.md index c052156..5544621 100644 --- a/docs/book/v3/example-flash-messenger-ext.md +++ b/docs/book/v3/example-flash-messenger-ext.md @@ -1,4 +1,4 @@ -# Using the flash messenger extension - not fully implemented!! +# Using the flash messenger extension - not fully implemented! Dot-twigrenderer extends Twig with functions that use functionality from [dotkernel/dot-flashMessenger](https://github.com/dotkernel/dot-flashMessenger) to list messages or partial messages. diff --git a/docs/book/v3/example-translation-ext.md b/docs/book/v3/example-translation-ext.md index 143db0a..b5bc776 100644 --- a/docs/book/v3/example-translation-ext.md +++ b/docs/book/v3/example-translation-ext.md @@ -5,6 +5,7 @@ Dot-twigrenderer extends Twig with a filter called `trans` that parses translati 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")` @@ -13,4 +14,4 @@ In order to have a proper behaviour of language selector, you need the language `dnf install glibc-all-langpacks` -Then restart PHP-FPM. +Then restart PHP-FPM. From 3350778fe384a012d8494dab8a4f16f7da14d336 Mon Sep 17 00:00:00 2001 From: bidi Date: Tue, 9 Apr 2024 18:03:43 +0300 Subject: [PATCH 3/8] updated documentation --- docs/book/v3/example-date-ext.md | 2 +- docs/book/v3/example-flash-messenger-ext.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/book/v3/example-date-ext.md b/docs/book/v3/example-date-ext.md index f68988b..cd58ae4 100644 --- a/docs/book/v3/example-date-ext.md +++ b/docs/book/v3/example-date-ext.md @@ -1,4 +1,4 @@ -# Using the date extension - not implemented! +# Using the date extension - not implemented 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. diff --git a/docs/book/v3/example-flash-messenger-ext.md b/docs/book/v3/example-flash-messenger-ext.md index 5544621..b3b6aeb 100644 --- a/docs/book/v3/example-flash-messenger-ext.md +++ b/docs/book/v3/example-flash-messenger-ext.md @@ -1,4 +1,4 @@ -# Using the flash messenger extension - not fully implemented! +# Using the flash messenger extension - not fully implemented Dot-twigrenderer extends Twig with functions that use functionality from [dotkernel/dot-flashMessenger](https://github.com/dotkernel/dot-flashMessenger) to list messages or partial messages. From 0ab1995e4ac35392ee2afb4a56e4dd97d25d2dfd Mon Sep 17 00:00:00 2001 From: bidi Date: Wed, 10 Apr 2024 12:16:21 +0300 Subject: [PATCH 4/8] updated documentation --- docs/book/v3/examples.md | 9 +++++++++ .../{ => examples}/example-authentication-ext.md | 0 .../{ => examples}/example-authorization-ext.md | 0 docs/book/v3/{ => examples}/example-date-ext.md | 0 .../example-flash-messenger-ext.md | 0 .../{ => examples}/example-form-elements-ext.md | 0 .../v3/{ => examples}/example-navigation-ext.md | 0 .../v3/{ => examples}/example-translation-ext.md | 0 mkdocs.yml | 16 +++++++++++++++- 9 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 docs/book/v3/examples.md rename docs/book/v3/{ => examples}/example-authentication-ext.md (100%) rename docs/book/v3/{ => examples}/example-authorization-ext.md (100%) rename docs/book/v3/{ => examples}/example-date-ext.md (100%) rename docs/book/v3/{ => examples}/example-flash-messenger-ext.md (100%) rename docs/book/v3/{ => examples}/example-form-elements-ext.md (100%) rename docs/book/v3/{ => examples}/example-navigation-ext.md (100%) rename docs/book/v3/{ => examples}/example-translation-ext.md (100%) diff --git a/docs/book/v3/examples.md b/docs/book/v3/examples.md new file mode 100644 index 0000000..7439e3f --- /dev/null +++ b/docs/book/v3/examples.md @@ -0,0 +1,9 @@ +# Examples + +* [Authentication Extension](examples/example-authentication-ext.md) +* [Authentication Extension](examples/example-authorization-ext.md) +* [Date Extension](examples/example-date-ext.md) +* [Flash Messenger Extension](examples/example-flash-messenger-ext.md) +* [Form Elements Extension](examples/example-form-elements-ext.md) +* [Navigation Extension](examples/example-navigation-ext.md) +* [Translation Extension](examples/example-translation-ext.md) diff --git a/docs/book/v3/example-authentication-ext.md b/docs/book/v3/examples/example-authentication-ext.md similarity index 100% rename from docs/book/v3/example-authentication-ext.md rename to docs/book/v3/examples/example-authentication-ext.md diff --git a/docs/book/v3/example-authorization-ext.md b/docs/book/v3/examples/example-authorization-ext.md similarity index 100% rename from docs/book/v3/example-authorization-ext.md rename to docs/book/v3/examples/example-authorization-ext.md diff --git a/docs/book/v3/example-date-ext.md b/docs/book/v3/examples/example-date-ext.md similarity index 100% rename from docs/book/v3/example-date-ext.md rename to docs/book/v3/examples/example-date-ext.md diff --git a/docs/book/v3/example-flash-messenger-ext.md b/docs/book/v3/examples/example-flash-messenger-ext.md similarity index 100% rename from docs/book/v3/example-flash-messenger-ext.md rename to docs/book/v3/examples/example-flash-messenger-ext.md diff --git a/docs/book/v3/example-form-elements-ext.md b/docs/book/v3/examples/example-form-elements-ext.md similarity index 100% rename from docs/book/v3/example-form-elements-ext.md rename to docs/book/v3/examples/example-form-elements-ext.md diff --git a/docs/book/v3/example-navigation-ext.md b/docs/book/v3/examples/example-navigation-ext.md similarity index 100% rename from docs/book/v3/example-navigation-ext.md rename to docs/book/v3/examples/example-navigation-ext.md diff --git a/docs/book/v3/example-translation-ext.md b/docs/book/v3/examples/example-translation-ext.md similarity index 100% rename from docs/book/v3/example-translation-ext.md rename to docs/book/v3/examples/example-translation-ext.md diff --git a/mkdocs.yml b/mkdocs.yml index 3450761..0231c9f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -8,7 +8,21 @@ extra: nav: - Home: index.md - v3: - - "Adding The Config Provider": v3/addingConfigProvider.md + - Installation: v3/installation.md + - Configuration: v3/configuration.md + - Usage: v3/usage.md + - Examples: v3/examples.md + - Reference: + - "Inject using a factory": v3/usage/factory.md + - "Inject using dot-annotated-services": v3/usage/injection.md + - Examples: + - "Authentication Extension": v3/examples/example-authentication-ext.md + - "Authentication Extension": v3/examples/example-authorization-ext.md + - "Date Extension": v3/examples/example-date-ext.md + - "Flash Messenger Extension": v3/examples/example-flash-messenger-ext.md + - "Form Elements Extension": v3/examples/example-form-elements-ext.md + - "Navigation Extension": v3/examples/example-navigation-ext.md + - "Translation Extension": v3/examples/example-translation-ext.md site_name: dot-log site_description: "DotKernel log component extending and customizing" repo_url: "https://github.com/dotkernel/dot-log" From 2d5d027825085d94e095624c131d33b5d15c6536 Mon Sep 17 00:00:00 2001 From: bidi Date: Wed, 10 Apr 2024 12:44:41 +0300 Subject: [PATCH 5/8] updated documentation --- docs/book/v3/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/book/v3/configuration.md b/docs/book/v3/configuration.md index b78c1b5..ebe3a80 100644 --- a/docs/book/v3/configuration.md +++ b/docs/book/v3/configuration.md @@ -1,5 +1,5 @@ # Configuration -Register `dot-session`'s ConfigProvider in your application's configurations by adding the following line to `config/config.php`: +Register `dot-twigrenderer`'s ConfigProvider in your application's configurations by adding the following line to `config/config.php`: \Dot\Twig\ConfigProvider::class, From 7cb05910ad82db1a4dbdc1462126529fb9780ce6 Mon Sep 17 00:00:00 2001 From: bidi Date: Wed, 10 Apr 2024 13:01:52 +0300 Subject: [PATCH 6/8] updated documentation --- docs/book/v3/examples.md | 2 +- docs/book/v3/examples/example-authorization-ext.md | 2 +- docs/book/v3/examples/example-date-ext.md | 2 +- docs/book/v3/examples/example-flash-messenger-ext.md | 2 +- docs/book/v3/examples/example-navigation-ext.md | 2 +- docs/book/v3/examples/example-translation-ext.md | 2 +- docs/book/v3/usage.md | 2 +- mkdocs.yml | 6 +++--- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/book/v3/examples.md b/docs/book/v3/examples.md index 7439e3f..0441b4b 100644 --- a/docs/book/v3/examples.md +++ b/docs/book/v3/examples.md @@ -1,7 +1,7 @@ # Examples * [Authentication Extension](examples/example-authentication-ext.md) -* [Authentication Extension](examples/example-authorization-ext.md) +* [Authorization Extension](examples/example-authorization-ext.md) * [Date Extension](examples/example-date-ext.md) * [Flash Messenger Extension](examples/example-flash-messenger-ext.md) * [Form Elements Extension](examples/example-form-elements-ext.md) diff --git a/docs/book/v3/examples/example-authorization-ext.md b/docs/book/v3/examples/example-authorization-ext.md index 2a127cc..fa51707 100644 --- a/docs/book/v3/examples/example-authorization-ext.md +++ b/docs/book/v3/examples/example-authorization-ext.md @@ -1,4 +1,4 @@ -# Using the authentication extension +# Using the authorization extension Dot-twigrenderer extends Twig with a function that uses functionality from [dotkernel/dot-authorization](https://github.com/dotkernel/dot-authorization) to check if a logged user is authorized to access a particular resource. diff --git a/docs/book/v3/examples/example-date-ext.md b/docs/book/v3/examples/example-date-ext.md index cd58ae4..882c10d 100644 --- a/docs/book/v3/examples/example-date-ext.md +++ b/docs/book/v3/examples/example-date-ext.md @@ -1,4 +1,4 @@ -# Using the date extension - not implemented +# 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. diff --git a/docs/book/v3/examples/example-flash-messenger-ext.md b/docs/book/v3/examples/example-flash-messenger-ext.md index b3b6aeb..adf1436 100644 --- a/docs/book/v3/examples/example-flash-messenger-ext.md +++ b/docs/book/v3/examples/example-flash-messenger-ext.md @@ -1,4 +1,4 @@ -# Using the flash messenger extension - not fully implemented +# Using the flash messenger extension Dot-twigrenderer extends Twig with functions that use functionality from [dotkernel/dot-flashMessenger](https://github.com/dotkernel/dot-flashMessenger) to list messages or partial messages. diff --git a/docs/book/v3/examples/example-navigation-ext.md b/docs/book/v3/examples/example-navigation-ext.md index 78498be..5af31ee 100644 --- a/docs/book/v3/examples/example-navigation-ext.md +++ b/docs/book/v3/examples/example-navigation-ext.md @@ -1,4 +1,4 @@ -# Using the form elements extension +# Using the navigation extension Dot-twigrenderer extends Twig with functions that use functionality from [dotkernel/dot-navigation](https://github.com/dotkernel/dot-navigation) to easily parse a menu and to display escaped HTML inside a template. diff --git a/docs/book/v3/examples/example-translation-ext.md b/docs/book/v3/examples/example-translation-ext.md index b5bc776..c7760ba 100644 --- a/docs/book/v3/examples/example-translation-ext.md +++ b/docs/book/v3/examples/example-translation-ext.md @@ -1,4 +1,4 @@ -# Using the form elements extension +# Using the translation extension Dot-twigrenderer extends Twig with a filter called `trans` that parses translations in singular and plural forms. diff --git a/docs/book/v3/usage.md b/docs/book/v3/usage.md index 740e550..999b010 100644 --- a/docs/book/v3/usage.md +++ b/docs/book/v3/usage.md @@ -1,6 +1,6 @@ # Usage -Basic usage to access and use the session object in your services: +Basic usage to access and use the twigrenderer object in your services: * [Method #1 - Factory](usage/factory.md) * [Method #2 - Injection](usage/injection.md) diff --git a/mkdocs.yml b/mkdocs.yml index 0231c9f..292093a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -23,8 +23,8 @@ nav: - "Form Elements Extension": v3/examples/example-form-elements-ext.md - "Navigation Extension": v3/examples/example-navigation-ext.md - "Translation Extension": v3/examples/example-translation-ext.md -site_name: dot-log -site_description: "DotKernel log component extending and customizing" -repo_url: "https://github.com/dotkernel/dot-log" +site_name: dot-twigrenderer +site_description: "DotKernel component providing twig extensions and customizations" +repo_url: "https://github.com/dotkernel/dot-twigrenderer" plugins: - search From 2bd7490e60114d9441c65dd9dcff58548520aa95 Mon Sep 17 00:00:00 2001 From: bidi Date: Thu, 11 Apr 2024 15:05:55 +0300 Subject: [PATCH 7/8] updated readme --- README.md | 2 +- mkdocs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 33960a1..fb052a4 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ DotKernel component providing twig extensions and customizations. [![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-twigrenderer)](https://github.com/dotkernel/dot-twigrenderer/stargazers) [![GitHub license](https://img.shields.io/github/license/dotkernel/dot-twigrenderer)](https://github.com/dotkernel/dot-twigrenderer/blob/3.0/LICENSE.md) -[![Build Static](https://github.com/dotkernel/dot-twigrenderer/actions/workflows/static-analysis.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-twigrenderer/actions/workflows/static-analysis.yml) +[![Build Static](https://github.com/dotkernel/dot-twigrenderer/actions/workflows/continuous-integration.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-twigrenderer/actions/workflows/continuous-integration.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-twigrenderer/graph/badge.svg?token=M2WTS4DCKX)](https://codecov.io/gh/dotkernel/dot-twigrenderer) [![SymfonyInsight](https://insight.symfony.com/projects/b9a7d75d-d00a-44a9-b1c0-aea8670681cc/big.svg)](https://insight.symfony.com/projects/b9a7d75d-d00a-44a9-b1c0-aea8670681cc) diff --git a/mkdocs.yml b/mkdocs.yml index 292093a..476c4cc 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -11,7 +11,7 @@ nav: - Installation: v3/installation.md - Configuration: v3/configuration.md - Usage: v3/usage.md - - Examples: v3/examples.md + - "Examples Overview": v3/examples.md - Reference: - "Inject using a factory": v3/usage/factory.md - "Inject using dot-annotated-services": v3/usage/injection.md From 2424013987615e5eb3ac2f72a6a5eed38e7d7559 Mon Sep 17 00:00:00 2001 From: bidi Date: Thu, 11 Apr 2024 15:37:47 +0300 Subject: [PATCH 8/8] added security.md --- SECURITY.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..d2e9839 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,40 @@ +# Security Policy + +## 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) | +| <= 2.x | :x: | | + + +## Reporting Potential Security Issues + +If you have encountered a potential security vulnerability in this project, +please report it to us at . 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. +