kotaru / sulu-news-bundle
Simple News Bundle for Sulu 2 CMS
Package info
github.com/KotaruS/sulu-news-bundle
Type:sulu-bundle
pkg:composer/kotaru/sulu-news-bundle
1.0.0
2026-06-09 12:34 UTC
Requires
- php: ^8.2
- kotaru/sulu-utils: ^1.0
- sulu/sulu: 2.6.24
- symfony/config: ^7.0
- symfony/dependency-injection: ^7.0
- symfony/framework-bundle: ^7.0
- symfony/http-foundation: ^7.0
- symfony/http-kernel: ^7.0
Requires (Dev)
- jangregor/phpstan-prophecy: ^2.0
- php-cs-fixer/shim: ^3.58
- phpspec/prophecy-phpunit: ^2.1
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^2.1
- phpstan/phpstan-doctrine: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpstan/phpstan-webmozart-assert: ^2.0
- phpunit/phpunit: ^11.5 || ^12.1
- rector/rector: ^2.0
- sulu/sulu-rector: ^2.0
- symfony/browser-kit: ^7.4
- symfony/css-selector: ^7.4
- symfony/debug-bundle: ^7.4
- symfony/error-handler: ^7.4
- symfony/phpunit-bridge: ^7.4
- symfony/thanks: ^1.2
- symfony/web-profiler-bundle: ^7.4
README
PHP 8.3+, Sulu 2.6, Symfony 7.4+
Installation
This bundle requires PHP 8.3 or later.
- Open a command console, enter your project directory and run:
composer require kotaru/sulu-news-bundle
You'll also need to add the bundle in your config/bundles.php file:
return [ //... Kotaru\Bundle\SuluNewsBundle\SuluNewsBundle::class => ['all' => true], ];
- Register the new routes by adding the following to your
config/routes/sulu_news_admin.yaml:
sulu_news_api: resource: "@SuluNewsBundle/Resources/config/routing_api.yaml" prefix: /admin/api
- Add following config to your
config/image-formats.xml:
<format key="article-header"> <meta> <title lang="cs">Úvodní obrázek článku (2100x900)</title> <title lang="en">Article Header (2100x900)</title> </meta> <scale x="2100" y="900" mode="outbound" /> </format>
-
Create a template in your
templates/news/index.html.twig: -
Enjoy the new features of your Sulu installation!
Extras
/admin/api/check/news/{uuid}endpoint for checking user permissions to edit this news page.
Twig extensions
Functions
get_related_news
Arguments:
uuid: page uuidlocale: locale to resolve news forlimit: how many news to load
Returns a list of related news with given locale
Usage:
{{ get_related_news('4afdde53-917b-40d2-aed7-3d74c485c39c','en',3) }}
Result:
[news1,news2,news3]