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/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ jobs:
fail-fast: false
matrix:
php-versions: ['8.1', '8.2', '8.3', '8.4']
twig-versions: ['3.19.0', '3.20.0', '3.21.0']
env:
PHP_VERSION: ${{ matrix.php-versions }}
TWIG_VERSION: ${{ matrix.twig-versions }}
steps:
- uses: actions/checkout@v4

Expand All @@ -31,7 +33,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -40,6 +42,11 @@ jobs:
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-reqs

- name: Install Twig version
run: |
composer require "twig/twig:~${TWIG_VERSION}" --no-progress --prefer-dist --optimize-autoloader --ignore-platform-reqs
composer info twig/twig

- name: Install Pest v3
run: composer require pest/pest:^3.0
if: ${{ matrix.php-version == '8.4' }}
Expand All @@ -51,7 +58,7 @@ jobs:
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: PHP_VERSION
env_vars: PHP_VERSION,TWIG_VERSION
file: ./coverage.xml
flags: unittests
fail_ci_if_error: false
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## v2.1.0 (2025-06-17)

### Added

- Add a `twig_toolkit_without` filter ([#36](https://github.com/studiometa/twig-toolkit/pull/36), [b2842a2](https://github.com/studiometa/twig-toolkit/commit/b2842a2))

### Fixed

- Fix Twig 3.21 deprecations ([#35](https://github.com/studiometa/twig-toolkit/pull/35), [6687590](https://github.com/studiometa/twig-toolkit/commit/6687590))

## v2.0.1 (2025-01-27)

### Changed
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@ Wrapper for the `Spatie\Url\Url` class to easily manipulate URLs. See the [`spat
{% set url = twig_toolkit_url(url).withQueryParameter('key', 'value') %}
```

### Filters

#### `{{ object|twig_toolkit_without('key', 'other_key') }}`

Returns the given hash without the specified keys.

**Params**

- `value` (`array`): the hash to remove the key from
- `...keys` (`string[]`): the keys to remove

**Examples**

```twig
{# Twig #}
{{ { foo: 1, bar: 2, baz: 3 }|twig_toolkit_without('bar')|keys|join(', ') }}

{# HTML #}
foo, baz
```

### Tags

#### `{% html_element '<tag>' with attrs %}`
Expand Down
Loading
Loading