Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Sonata Annotation Bundle

Sonata Annotation Bundle Laravel Package

kunicmarko/sonata-annotation-bundle

A Symfony bundle that lets you configure Sonata Admin classes with PHP annotations instead of YAML or PHP config. Define admin services plus list, form, show, and datagrid fields directly in annotations, keeping your admin setup compact and close to your entities.

View on GitHub
Deep Wiki
Context7

Annotations for Sonata Admin

Frequently asked questions about Sonata Annotation Bundle
Is kunicmarko/sonata-annotation-bundle compatible with Laravel?
No. It is a Symfony bundle built for Sonata Admin and depends on Symfony bundle registration and Doctrine annotation reading, so it does not provide Laravel service providers or Eloquent integration. Laravel developers should treat it as out of scope unless they are maintaining a Symfony/Sonata application.
What Symfony, Sonata Admin, PHP, and Doctrine versions does this bundle support?
The last release is from July 2019, and its tested surface is the Symfony 4.x, Sonata Admin 3.x, PHP 7.x, and doctrine/annotations era. Modern Symfony 6/7, Sonata Admin 4/5, PHP 8.2+, and doctrine/orm 3 with annotations removed are not validated. Composer may refuse to resolve or produce an untested combination.
How do I install and register SonataAnnotationBundle?
Install it with Composer using kunicmarko/sonata-annotation-bundle, then register the bundle in config/bundles.php for Symfony. You also need Sonata Admin configured and Doctrine annotations available, because the bundle reads annotations at runtime. On a current Symfony app, check dependency resolution before assuming the install will succeed.
What does SonataAnnotationBundle actually replace in a Sonata Admin class?
It replaces repetitive configureFormFields, configureListFields, configureDatagridFilters, and configureShowFields methods with annotations on the entity or admin class. The bundle translates those annotations into the same Sonata metadata structures Sonata Admin already uses. It does not replace Sonata Admin itself or change how admin services are authorized.
Does this bundle support PHP 8 attributes instead of Doctrine annotations?
No. The package is annotation-driven and predates the ecosystem's move to PHP 8 attributes. doctrine/annotations is in maintenance mode, so adopting this DSL now means planning a migration to attributes or explicit configuration later. There is no upstream attribute-based release.
Is kunicmarko/sonata-annotation-bundle abandoned?
Yes, the repository is archived, has about 21 stars, zero dependents, and no release in roughly six years. There is no upstream compatibility path, security response process, or community to amortize bug discovery. Treat it as unmaintained code rather than an actively supported dependency.
Can I use it with Sonata Admin 4 or 5 on Symfony 6 or 7?
Not without a fork. The bundle's constraints and runtime hooks target the older Sonata Admin 3 and Symfony 4 line, and it relies on doctrine/annotations being present. On Sonata Admin 4/5 the work is a modernization project, not a simple Composer require. Pin and test only if you control the fork.
How risky is it to use this bundle in production?
The main risks are maintenance cost and correctness, not security exposure. Behavior is derived by reflection at runtime, so static analysis, IDE navigation, and find-usages degrade, and misplaced or misspelled annotations can fail silently. The blast radius is limited because it generates admin configuration only and is not on an authorization or data-integrity path.
Are there alternatives for reducing Sonata Admin boilerplate?
For a legacy Sonata Admin 3 estate, keeping explicit configure methods is the safest default: verbose but greppable, statically analyzable, and version-proof. If boilerplate cost is measurably painful, fork and vendor the small surface area under your own namespace and pin it to your exact Symfony/Sonata matrix. For modern stacks, prefer native Sonata Admin 4/5 configuration or PHP attributes rather than an annotation-only DSL.
Should I fork and vendor it for a legacy Sonata Admin 3 application?
Only if the number of admin classes is high enough that the boilerplate cost is real; below roughly 10 to 15 admins the return on a fork is poor. A fork means owning PHP 8 attribute migration, Composer constraints, and bug fixes indefinitely. If you proceed, publish it internally or via a VCS path repository and treat it as first-party code.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections