os2display/core-bundle
Core bundle for the OS2display digital signage platform, providing shared domain models, services, and integration glue for screens, content, and scheduling. A foundational PHP/Symfony package for building and extending OS2display deployments.
os2display/core-bundle is the shared domain bundle behind the OS2display digital-signage platform. Before you composer require it, note one thing that shapes everything else: this is a Symfony bundle, not a Laravel package. It ships a *Bundle class, a DependencyInjection/ extension, Doctrine entity mappings and event listeners — there is no service provider, no facade, no config file under config/. If you are working in a Laravel app, treat it as a library you integrate deliberately (see Gotchas) rather than something that "just works" after install.
Minimal first steps:
composer require os2display/core-bundle:^2.2 and confirm the constraint resolves against your PHP version — the 2.x line targets modern PHP, but check composer.json in the package for the exact floor.composer.json (dependencies tell you whether it expects JMS Serializer, Doctrine ORM, or Symfony's own serializer), Entity/ (your actual domain model — screens, slides, playlists, media, channels), then EventListener/SerializationListener.php (the file touched in this release).bundles.php and make sure Doctrine picks up the mapping. In a Symfony app this is one line; in Laravel you will need a Doctrine bridge (doctrine/orm plus something like laravel-doctrine/orm) and manual mapping registration.First use case worth wiring end-to-end: create, list and edit screens via a JSON API. That single flow exercises the entities, the repository layer and — critically — the serialization listener, which is where this release made changes.
Inject the repositories, don't touch the EM. The bundle's entities are plain Doctrine entities; the stable seam for your application code is EntityManagerInterface plus the bundle's repositories. Wrap them in your own thin service (ScreenService, PlaylistService) so that when the bundle's mapping changes in a minor release you have one place to patch instead of fifty controllers.
Serialization is the surface you should own. The bundle deliberately keeps a SerializationListener that decorates entity (de)serialization, and this patch fixes a bug in it. Don't rely on implicit serialization of entities in your controllers. Instead:
Screen and a Slide, so a future listener change fails loudly in your suite rather than silently in production.Typical workflow for a resource endpoint:
// app/Services/ScreenService.php
public function __construct(private EntityManagerInterface $em) {}
public function paginate(int $page = 1, int $perPage = 25): array
{
return $this->em->getRepository(Screen::class)
->findBy([], ['id' => 'ASC'], $perPage, ($page - 1) * $perPage);
}
Keep the entity inside the service; return DTOs outward.
Roles: consume the constant, not the string. 2.2.3 introduces a screen administrator role. The correct integration is to reference whatever constant/enum the bundle exposes (look in the bundle's security/role class or Resources/config) and add it to your role hierarchy in one place:
// Symfony security.yaml
role_hierarchy:
ROLE_SCREEN_ADMIN: [ROLE_USER]
Then gate screen mutations with a voter or denyAccessUnlessGranted() rather than sprinkling isGranted('ROLE_...') checks with hardcoded strings. When the bundle later renames the role, you change one line.
Treat the bundle as the model, your app as the policy. A workable split that holds up over time: bundle entities = persistence shape; your services = validation, authorization and business rules; your serializers = wire format. Do not subclass bundle entities to add fields — Doctrine inheritance across a vendor boundary gets painful fast. Add a related entity or a JSON metadata column instead.
Fixtures and seeding. Because the bundle ships no migrations, keep a make db-reset style task that runs your migrations and the bundle's fixtures (if present) in a deterministic order. Screen/slide content is graph-like; getting seed data right early saves a lot of debugging.
Upgrade rhythm. Pin to ^2.2 and read each patch note. These are small, frequent releases; a monthly composer update os2display/core-bundle --with-dependencies plus your integration test suite is the sane cadence.
CoreBundleServiceProvider, no config/core.php, no publishes(). Any tutorial assuming Laravel conventions will mislead you. Budget real time for the Doctrine bridge, entity mapping registration and container wiring.bin/console debug:event-dispatcher (Symfony) is the fastest way to see what is actually attached.cache:clear, doctrine:cache:clear-metadata). A stale metadata cache produces "unknown column"-style errors that look like broken code but aren't.DependencyInjection extension, which means keys are bundled and validated at compile time, not runtime. Errors surface during container build, not on request — read the full compiler output rather than just the last line.vendor/; if you need a change, send it upstream (the project clearly takes PRs — this release is one) or decorate./health or /about endpoint. When a bug report lands, knowing whether it is pre- or post-2.2.3 saves a round trip.How can I help you explore Laravel packages today?