dravencms / location
DravenCMS Location module
Requires
- php: >=8.2
- composer-runtime-api: ^2.0
- dravencms/application: ^0.3
- dravencms/base-form: >=0.0.1
- dravencms/base-grid: >=0.0.1
- dravencms/database: >=0.0.3
- symfony/console: ^6.4 || ^7.0 || ^8.0
- umpirsky/country-list: ^2.0
Requires (Dev)
None
Suggests
- dravencms/admin: Provides admin inteface to manage locations
- dravencms/user: Provides ACL settings
Provides
None
Conflicts
- dravencms/admin: <3.2
- dravencms/user: <3.1
Replaces
None
README
Reusable geographical data model and administration for DravenCMS. It manages countries, regions, cities, streets, street numbers, and postal codes for packages that need structured addresses.
Features
- Country data based on
umpirsky/country-list. - Region, city, street, street-number, and ZIP-code entities.
- Repositories and pair/query helpers for application forms.
- Optional administration grids and forms.
- Provider-defined ACL permissions and admin navigation.
Installation
composer require dravencms/location
The package loader registers its services and Doctrine attribute mappings. Apply the package schema through the application's migration workflow and run php bin/console location:setup to install country data before creating dependent records.
Install dravencms/admin to expose management presenters and dravencms/user for provider-defined permissions.
Usage
Inject the repository matching the required level, such as CountryRepository, CityRepository, or StreetRepository. Store entity relationships rather than duplicated display strings when the address must remain queryable.
The package models location levels independently because real addresses do not always have every level. Application validation should require only the parts needed by that domain.
License
This package is licensed under the LGPL-3.0 license.
Installing default data
Run php bin/console location:setup after creating or migrating the application schema. The command adds missing defaults in a transaction and can be rerun on an active project. It never purges data or updates existing records, including customized names, formats, templates, active flags and default selections. Run setup commands one at a time. Schema creation/migration remains separate. Fixtures are no longer registered.
Adds all countries from the installed English country dataset, matching by country code. Add --example-address to explicitly install the former Olomouc / 77900 / Brněnská / 54 example; address rows are matched within their parent country, city, ZIP code or street.
Admin authorization and mutations
Administration uses User 3.1, Admin 3.2 and Application 0.3 guards. Screens and write callbacks enforce the existing provider-defined permissions server-side, including direct URLs and bulk callbacks. Mutating signals require POST and a session-bound action token; synchronize the matching admin assets when upgrading. See the User package's user:security:migrate instructions for the password-reset schema change.