ezsystems/ezplatform-kernel
eZ Platform Kernel provides the core Symfony-based runtime for eZ Platform/Ibexa CMS: content repository, persistence, REST and siteaccess handling, security, and extension points. Used as the foundation for building and running eZ Platform applications.
Installation:
composer require ezsystems/ezplatform-kernel
Ensure your project extends EzSystems\EzPlatformKernel\EzPlatformKernel in config/bundle.php:
new EzSystems\EzPlatformKernel\EzPlatformKernel($rootDir.'/config/bundle.php', $env),
First Use Case:
Repository service to fetch content:
use Ibexa\Contracts\Core\Repository\RepositoryInterface;
class MyController extends AbstractController {
public function index(RepositoryInterface $repository): Response
{
$searchService = $repository->getSearchService();
$result = $searchService->findContent();
// Render results...
}
}
Key Files:
config/bundle.php: Kernel configuration.config/services.yaml: Define custom services (e.g., ezpublish.siteaccess).src/Kernel.php: Extend EzPlatformKernel for custom logic.Content Repository Integration:
RepositoryInterface to interact with content:
$locationService = $repository->getLocationService();
$contentService = $repository->getContentService();
SearchService for queries:
$query = new Query\Query();
$query->query = new Query\Criterion\MatchAll();
$result = $searchService->findContent($query);
Siteaccess Management:
config/bundle.php:
'siteaccess' => [
'default' => 'site1',
'list' => ['site1', 'admin'],
],
$repository->setCurrentSiteaccess('admin');
Event Listeners:
ContentPublish, LocationMove):
# config/services.yaml
services:
App\EventSubscriber\MySubscriber:
tags:
- { name: kernel.event_subscriber }
Custom Content Types:
config/ibexa/content_types/my_type.yaml):
my_type:
identifier: my_type
fields:
- { identifier: title, type: ezstring }
ezpublish.form.type.content for content editing:
$builder->add('content', ContentType::class, [
'repository' => $repository,
]);
$twig->addFunction(new \Twig\TwigFunction('ez_current_siteaccess', [$repository, 'getCurrentSiteaccess']));
ezpublish.api for GraphQL/REST endpoints.Siteaccess Context:
setCurrentSiteaccess() can lead to silent failures (e.g., missing translations or content).if (!$repository->getCurrentSiteaccess()->getName() === 'admin') {
throw new \RuntimeException('Invalid siteaccess');
}
Caching Quirks:
php bin/console ezplatform:cache:clear
ezplatform:cache:clear --env=dev to bypass production caching.Content Service Pitfalls:
ContentService::loadContent() returns null for unpublished content. Use ContentService::loadVersion() for drafts.ContentService::publishVersion() with ContentService::loadContent() to avoid race conditions.Dependency Injection:
Repository or SearchService. Always inject via Symfony’s DI container.ServiceNotFoundException often means missing ezpublish.siteaccess config.config/packages/ez_platform.yaml:
ez_platform:
system:
debug: true
Query::debug() to inspect search queries:
$query->debug(true);
php bin/console doctrine:schema:dump --em=ezpublish
FieldType and register in config/ibexa/field_types.yaml:
my_field_type:
type: App\FieldType\MyFieldType
EzSystems\EzPlatformKernel\Event\KernelEvents for custom logic:
$dispatcher->addListener(KernelEvents::PRE_BOOT, [$this, 'onKernelPreBoot']);
EzSystems\EzPlatformKernel\Controller\ContentController for custom routes:
class CustomContentController extends ContentController {
public function customAction(RepositoryInterface $repository) { ... }
}
config/routes.yaml:
app_custom_content:
path: /custom
controller: App\Controller\CustomContentController::customAction
How can I help you explore Laravel packages today?