PHPackages                             kotaru/sulu-utils - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kotaru/sulu-utils

ActiveSulu-utilities[Utility &amp; Helpers](/categories/utility)

kotaru/sulu-utils
=================

Collection of utilities and improvements for Sulu 2 CMS

1.0.0(today)01↑2900%1MITPHPPHP ^8.2

Since Jun 9Pushed todayCompare

[ Source](https://github.com/KotaruS/sulu-utils)[ Packagist](https://packagist.org/packages/kotaru/sulu-utils)[ Docs](https://github.com/KotaruS/sulu-utils)[ RSS](/packages/kotaru-sulu-utils/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (24)Versions (2)Used By (1)

Improvements for Sulu CMS
=========================

[](#improvements-for-sulu-cms)

PHP 8.3+, Sulu 2.6, Symfony 7.4+

[![GitHub release](https://camo.githubusercontent.com/eb0ce063cd45be6f126c3424ab290573920962a39e62788048a0867c0a3214f0/68747470733a2f2f666c61742e62616467656e2e6e65742f6769746875622f72656c656173652f4b6f74617275532f73756c752d7574696c73)](https://camo.githubusercontent.com/eb0ce063cd45be6f126c3424ab290573920962a39e62788048a0867c0a3214f0/68747470733a2f2f666c61742e62616467656e2e6e65742f6769746875622f72656c656173652f4b6f74617275532f73756c752d7574696c73)[![Supports Sulu 3.0 or later](https://camo.githubusercontent.com/95baf11659ec93686f2f5c0fe1ca453aada2d0a0180257c40f10764be957bac0/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f53756c752f322e362f3532423543393f69636f6e3d706870)](https://camo.githubusercontent.com/95baf11659ec93686f2f5c0fe1ca453aada2d0a0180257c40f10764be957bac0/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f53756c752f322e362f3532423543393f69636f6e3d706870)

Installation
------------

[](#installation)

This bundle requires PHP 8.3 or later. Make sure to have installed [Node 18](https://nodejs.org/en/) or later for building the Sulu administration UI.

1. Open a command console, enter your project directory and run:

```
composer require kotaru/sulu-utils
```

You'll also need to add the bundle in your `config/bundles.php` file:

```
return [
    //...
    Kotaru\SuluUtils\SuluUtilsBundle::class => ['all' => true],
];
```

2. Register the new routes by adding the following to your `config/routes/sulu_utils.yaml`:

```
sulu_utils:
    resource: "@SuluUtilsBundle/Resources/config/routing.yaml"
```

and also add `config/routes/sulu_utils_admin.yaml`:

```
sulu_utils_api:
    resource: "@SuluUtilsBundle/Resources/config/routing_api.yaml"
    prefix: /admin/api
```

3. Add the file `config/packages/sulu_ai_translator.yaml` with the following configuration:

```
sulu_utils:
    location:
        default_center: [49.7528799, 15.5126953] # default center for the sulu location form field and map_points form field
        default_zoom: 8 # default zoom for location and map_points
    # available styles for ckeditor, label will be automatically translated
    styles:
        - {
              label: "app_admin.styles.button_special",
              element: "button",
              classes: ["styled__button--special"],
          }
        - {
              label: "app_admin.styles.button_special_inverse",
              element: "button",
              classes: ["styled__button--special-inverse"],
          }
```

Via `locale_mapping` you can map a locale key from your webspace to the according [official DeepL target language](https://developers.deepl.com/docs/resources/supported-languages#target-languages). Use value `null` for languages that should not be translatable.

4. Reference the frontend code by adding the following to your `assets/admin/package.json`:

```
"dependencies": {
    "sulu-utils-bundle": "file:../../vendor/kotaru/sulu-utils/Resources/js"
}
```

5. Import the frontend code by adding the following to your `assets/admin/app.js`:

```
import "sulu-utils-bundle";
```

6. Install all npm dependencies and build the admin UI ([see all options](https://docs.sulu.io/en/2.6/cookbook/build-admin-frontend.html)):

```
cd assets/admin
npm install
npm run build
```

7. **Enjoy the new features of your Sulu installation!**

Admin changes/additions
-----------------------

[](#admin-changesadditions)

### Ckeditor

[](#ckeditor)

- Added non-breaking space (`Ctrl/Cmd + Alt + X`)
- Added html button inside the text
- Added block quote
- Added configurable styles through `sulu_utils.styles` config.

### Other

[](#other)

- Added toggle toolbar action to list views `(TogglerToolbarAction)`.
- Added `/admin/api/check/page/{uuid}` endpoint for checking user permissions to edit this page.
- Added [Redirect controller](#redirect-template).
- Added `/api/translations/{locale}` endpoint for getting all `website` domain translations for use in frontend.
- Added new link type `local`: allows the use of simple `#something` links,
- Added generic form builder for views that need form fields but don't have multiple IDs (e.g. settings pages).

### Redirect template

[](#redirect-template)

- create a `config/templates/pages/redirect.xml` file and use the controller

```
...
redirect

pages/redirect
Kotaru\SuluUtils\Controller\Website\RedirectController::indexAction
604800
...
```

Form fields
-----------

[](#form-fields)

### Modified `location` form field

[](#modified-location-form-field)

```

    Bod na mapě
    Map Location

```

### New `map_points` form field

[](#new-map_points-form-field)

Acts the same as `location` field except it allows creating multiple points on a map in one field.

```

    Body na mapě
    Map Points

```

### New `text_line_autocomplete` form field

[](#new-text_line_autocomplete-form-field)

Acts the same as `text_line` except you can provide a list of autocomplete values.

```

    Chod
    Meal Course

```

### New `range` field

[](#new-range-field)

```

    Velikost
    Size

          1/12
          1/12

          1/6
          1/6

      ...

```

Twig extensions
---------------

[](#twig-extensions)

### Filters

[](#filters)

[`parse_iframes`](#parse_iframes), [`json_decode`](#json_decode), [`format_bytes`](#format_bytes), [`get_contents`](#get_contents), [`set_index_data`](#set_index_data), [`video_url`](#video_url), [`video_id`](#video_id)

#### `parse_iframes`

[](#parse_iframes)

For setting height on iframes and extra parsing of youtube, vimeo and google maps embeds.

**Usage:**

```
{% set iframe = '' %}
{{ iframe|parse_iframes('200px') }}
Result:

```

#### `json_decode`

[](#json_decode)

Uses PHP json\_decode, decodes to array.

**Usage:**

```
{% set json = '{ "x": 2, "y": "hey" }' %}
{{ json|json_decode }}
Result:
{# array(
  x => 2,
  y => "hey") #}
```

#### `format_bytes`

[](#format_bytes)

Humanizes output in bytes to friendly decimal SI multiples (`MB`, `GB`,...).

**Usage:**

```
{% set bytes = 1073741824 %}
{{ bytes|format_bytes }}
Result:
1.07 GB
```

#### `get_contents`

[](#get_contents)

Returns text contents of a Sulu media. Processes the file if it's json or csv to array.

**Usage:**

```
{% set file = Sulu\Bundle\MediaBundle\Api\Media instance %}
{{ file|get_contents }}
Result:
{# Text contents of the file. Useful for json or csv with built in parser #}
```

#### `set_index_data`

[](#set_index_data)

Allows easy manipulation of arrays – adding, appending to indexes.

**Usage:**

```
{% set arr = [{b: 1}, {x: 2}] %}
{{ arr|set_index_data(1, {y: 3}) }}
Result:
{# arr: [{b: 1}, {y: 3}] #}
```

#### `video_url`

[](#video_url)

Extracts the URL part of an iframe.

**Usage:**

```
{% set video = '' %}
{{ video|video_url }}
Result:
{# https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?si=0A7y6tuaBLdqVVwJ #}
```

#### `video_id`

[](#video_id)

Extracts the id part of a youtube or vimeo video.

**Usage:**

```
{% set video = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ&pp=ygUIcmlja3JvbGw%3D' %}
{{ video|video_id }}
Result:
{# dQw4w9WgXcQ #}
```

### Functions

[](#functions)

[`sulu_resolve_page`](#sulu_resolve_page), [`uuid`](#uuid), [`get_setting`](#get_setting),

#### `sulu_resolve_page`

[](#sulu_resolve_page)

**Arguments:**

- `uuid`: page uuid
- `locale`: locale to resolve page for

Return a page url for a give locale

**Usage:**

```
{{ sulu_resolve_page('4afdde53-917b-40d2-aed7-3d74c485c39c','en') }}
Result:
/en/some-path
```

#### `uuid`

[](#uuid)

**Arguments:**

- `length`: length of the uuid

Return a uuid4 of x length

**Usage:**

```
{{ uuid() }}
Result:
{# uuid4 value of specified length (default: 32), e.g. b9ee2ccce2db41d8a734205372e020c6 #}
```

#### `get_setting`

[](#get_setting)

**Arguments:**

- `settingKey`: the key of the setting that you want to retrieve

Return contents of a setting entity under provided key

**Usage:**

```
{{ get_setting('news_homepage') }}
Result:
{# ['id' => 4afdde53-917b-40d2-aed7-3d74c485c39c] or any value #}
```

### Tests

[](#tests)

[`instanceof`](#instanceof), [`number`](#number)

#### `instanceof`

[](#instanceof)

Checks if the variable is instance of ...

**Usage:**

```
{{ objectX is instanceof App\Objects\Y }}
Result:
{# true or false #}
```

#### `number`

[](#number)

Checks if the variable is a number.

**Arguments:**

- `strict`: if true, doesn't accept numeric strings.

**Usage:**

```
{% set x = '411' %}
{{ x is number }}
{{ x is number(true) }}
Result:
{# true #}
{# false #}
```

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bcdf8c8ea364f6e733b17bd9cb1a32325d552ab351efea8b8eedc26eb7e925a3?d=identicon)[kotaru](/maintainers/kotaru)

---

Top Contributors

[![KotaruS](https://avatars.githubusercontent.com/u/34488740?v=4)](https://github.com/KotaruS "KotaruS (2 commits)")

---

Tags

utilitiessulusulucms

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kotaru-sulu-utils/health.svg)

```
[![Health](https://phpackages.com/badges/kotaru-sulu-utils/health.svg)](https://phpackages.com/packages/kotaru-sulu-utils)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M370](/packages/easycorp-easyadmin-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M195](/packages/sulu-sulu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
