Sulu CMS Custom Bundle Development

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Custom Bundle Development for Sulu

A Bundle in Sulu is a Symfony Bundle with additional integrations: registration of property types, backoffice routes, AdminPool dependencies, Doctrine migrations. It's developed when functionality needs to be reused across multiple projects or when isolating domain logic.

Bundle Structure

src/
└── ReviewBundle/
    ├── Admin/
    │   └── ReviewAdmin.php         # backoffice registration
    ├── Controller/
    │   ├── Admin/
    │   │   └── ReviewController.php
    │   └── Website/
    │       └── ReviewWidgetController.php
    ├── DependencyInjection/
    │   ├── ReviewExtension.php
    │   └── Configuration.php
    ├── Document/
    ├── Entity/
    │   └── Review.php
    ├── Repository/
    │   └── ReviewRepository.php
    ├── Resources/
    │   ├── config/
    │   │   ├── doctrine/
    │   │   │   └── Review.orm.xml
    │   │   ├── routes_admin.yaml
    │   │   └── services.xml
    │   └── js/                     # backoffice frontend
    │       ├── index.js
    │       ├── views/
    │       └── containers/
    ├── ReviewBundle.php
    └── composer.json

Bundle Registration

// src/ReviewBundle/ReviewBundle.php
namespace App\ReviewBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ReviewBundle extends Bundle
{
    public function getPath(): string
    {
        return \dirname(__DIR__);
    }
}
// config/bundles.php
return [
    // ...
    App\ReviewBundle\ReviewBundle::class => ['all' => true],
];

DependencyInjection Extension

// DependencyInjection/ReviewExtension.php
namespace App\ReviewBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

class ReviewExtension extends Extension
{
    public function load(array $configs, ContainerBuilder $container): void
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $container->setParameter('review.per_page', $config['per_page']);
        $container->setParameter('review.moderation', $config['moderation']);

        $loader = new XmlFileLoader(
            $container,
            new FileLocator(__DIR__ . '/../Resources/config')
        );
        $loader->load('services.xml');
    }
}

Admin Class for Backoffice

// Admin/ReviewAdmin.php
namespace App\ReviewBundle\Admin;

use Sulu\Bundle\AdminBundle\Admin\Admin;
use Sulu\Bundle\AdminBundle\Admin\Navigation\NavigationItem;
use Sulu\Bundle\AdminBundle\Admin\Navigation\NavigationItemCollection;
use Sulu\Bundle\AdminBundle\Admin\View\ToolbarAction;
use Sulu\Bundle\AdminBundle\Admin\View\ViewBuilderFactoryInterface;
use Sulu\Bundle\AdminBundle\Admin\View\ViewCollection;
use Sulu\Component\Security\Authorization\PermissionTypes;
use Sulu\Component\Security\Authorization\SecurityCheckerInterface;

class ReviewAdmin extends Admin
{
    const REVIEW_LIST_VIEW   = 'review.list';
    const REVIEW_EDIT_VIEW   = 'review.edit_form';
    const SECURITY_CONTEXT   = 'sulu.review.reviews';

    public function __construct(
        private readonly ViewBuilderFactoryInterface $viewBuilderFactory,
        private readonly SecurityCheckerInterface $securityChecker
    ) {}

    public function configureNavigationItems(NavigationItemCollection $collection): void
    {
        if (!$this->securityChecker->hasPermission(self::SECURITY_CONTEXT, PermissionTypes::VIEW)) {
            return;
        }

        $item = new NavigationItem('review.reviews');
        $item->setPosition(40);
        $item->setView(self::REVIEW_LIST_VIEW);
        $item->setIcon('su-star');

        $collection->add($item);
    }

    public function configureViews(ViewCollection $collection): void
    {
        $listView = $this->viewBuilderFactory
            ->createListViewBuilder(self::REVIEW_LIST_VIEW, '/reviews')
            ->setResourceKey('reviews')
            ->setListKey('reviews')
            ->setTitle('review.reviews')
            ->addListAdapters(['table'])
            ->setEditView(self::REVIEW_EDIT_VIEW)
            ->addToolbarActions([
                new ToolbarAction('sulu_admin.add'),
                new ToolbarAction('sulu_admin.delete'),
            ]);

        $editView = $this->viewBuilderFactory
            ->createResourceTabViewBuilder(self::REVIEW_EDIT_VIEW, '/reviews/:id')
            ->setResourceKey('reviews')
            ->setBackView(self::REVIEW_LIST_VIEW);

        $collection->add($listView);
        $collection->add($editView);
    }

    public function getSecurityContexts(): array
    {
        return [
            self::SECURITY_CONTEXT => [
                PermissionTypes::VIEW,
                PermissionTypes::ADD,
                PermissionTypes::EDIT,
                PermissionTypes::DELETE,
            ],
        ];
    }
}

REST API Controller for Backoffice

// Controller/Admin/ReviewController.php
namespace App\ReviewBundle\Controller\Admin;

use App\ReviewBundle\Repository\ReviewRepository;
use FOS\RestBundle\Controller\AbstractFOSRestController;
use FOS\RestBundle\View\ViewHandlerInterface;
use Sulu\Component\Rest\ListBuilder\Doctrine\DoctrineListBuilderFactoryInterface;
use Sulu\Component\Rest\ListBuilder\Metadata\FieldDescriptorFactoryInterface;
use Sulu\Component\Rest\RestHelperInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class ReviewController extends AbstractFOSRestController
{
    public function __construct(
        ViewHandlerInterface $viewHandler,
        private readonly ReviewRepository $repository,
        private readonly RestHelperInterface $restHelper,
        private readonly FieldDescriptorFactoryInterface $fieldDescriptorFactory,
        private readonly DoctrineListBuilderFactoryInterface $listBuilderFactory
    ) {
        parent::__construct($viewHandler);
    }

    #[Route('/api/reviews', methods: ['GET'])]
    public function cgetAction(Request $request): Response
    {
        $fieldDescriptors = $this->fieldDescriptorFactory->getFieldDescriptors('reviews');
        $listBuilder = $this->listBuilderFactory->create(Review::class);

        $this->restHelper->initializeListBuilder($listBuilder, $fieldDescriptors);

        $list = new ListRepresentation(
            $listBuilder->execute(),
            'reviews',
            'review_api_review_cget',
            $request->query->all(),
            $listBuilder->getCurrentPage(),
            $listBuilder->getLimit(),
            $listBuilder->count()
        );

        return $this->handleView($this->view($list));
    }

    #[Route('/api/reviews', methods: ['POST'])]
    public function postAction(Request $request): Response
    {
        $data = $request->toArray();
        $review = $this->repository->createFromArray($data);
        $this->repository->save($review, true);

        return $this->handleView($this->view($review, 201));
    }

    #[Route('/api/reviews/{id}', methods: ['DELETE'])]
    public function deleteAction(int $id): Response
    {
        $this->repository->removeById($id);
        return $this->handleView($this->view(null, 204));
    }
}

Custom Property Type (Content Type)

// ContentType/ReviewListContentType.php
namespace App\ReviewBundle\ContentType;

use Sulu\Component\Content\Compat\PropertyInterface;
use Sulu\Component\Content\SimpleContentType;

class ReviewListContentType extends SimpleContentType
{
    public function __construct(private readonly ReviewRepository $repository) {}

    public function read(
        NodeInterface $node,
        PropertyInterface $property,
        string $webspaceKey,
        string $languageCode,
        string $segmentKey
    ): void {
        $value = $node->getPropertyValueWithDefault($property->getName(), null);
        $property->setValue($value);
    }

    public function getContentData(PropertyInterface $property): array
    {
        $config = $property->getValue();
        if (!$config) return [];

        return $this->repository->findPublished(
            limit: $config['limit'] ?? 5,
            rating: $config['min_rating'] ?? null
        );
    }

    public function getViewData(PropertyInterface $property): array
    {
        return $property->getValue() ?? [];
    }
}

Service Registration

<!-- Resources/config/services.xml -->
<services>
    <service id="review.admin" class="App\ReviewBundle\Admin\ReviewAdmin">
        <argument type="service" id="sulu_admin.view_builder_factory"/>
        <argument type="service" id="sulu_security.security_checker"/>
        <tag name="sulu.admin"/>
        <tag name="sulu.context" context="admin"/>
    </service>

    <service id="review.content_type.review_list"
             class="App\ReviewBundle\ContentType\ReviewListContentType">
        <argument type="service" id="review.repository"/>
        <tag name="sulu.content.type" alias="review_list"/>
    </service>
</services>

Timeline

Bundle with Doctrine entity, REST API, and backoffice registration (no frontend): 5–7 days. With custom backoffice frontend (React/Preact components), migrations, and custom property type: 2–3 weeks.