PHPackages                             considbrs-webdev/modularity-service-info - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. considbrs-webdev/modularity-service-info

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

considbrs-webdev/modularity-service-info
========================================

Modularity Service Information Module

088↓37.5%PHP

Since Feb 19Pushed 1mo agoCompare

[ Source](https://github.com/Considbrs-Webdev/modularity-service-info)[ Packagist](https://packagist.org/packages/considbrs-webdev/modularity-service-info)[ RSS](/packages/considbrs-webdev-modularity-service-info/feed)WikiDiscussions dev Synced 3w ago

READMEChangelogDependenciesVersions (4)Used By (0)

Modularity Service Information
==============================

[](#modularity-service-information)

A WordPress plugin that provides a complete solution for managing and displaying service information. Built as a Modularity module for use with the Municipio theme.

Features
--------

[](#features)

### Custom Post Type

[](#custom-post-type)

- **Service Information Post Type** (`service_information`) for creating and managing service info entries
- Supports title, content, thumbnail, excerpt, and revisions
- Configurable URL slug via settings
- REST API support for headless usage

### Taxonomy

[](#taxonomy)

- **Service Categories** taxonomy for organizing service information
- Hierarchical categories with custom icons
- Admin column for easy filtering

### Modularity Module

[](#modularity-module)

- **Service Info Module** for displaying service information on pages and posts
- Flexible display options:
    - Configurable number of posts to show
    - Option to show/hide icons
    - Link to service information archive
    - Archive mode (show all posts)
    - Group posts by categories
    - Show/hide empty categories
- Custom styling and responsive design

### Single Post Template

[](#single-post-template)

- Custom template for displaying individual service information posts
- Displays service date range with formatted dates
- Integrates with Municipio theme components

### Menu Integration

[](#menu-integration)

- Custom menu item type for adding service information link to navigation
- **Badge notification** showing the count of active service information posts
- Works with both classic menu editor and Customizer
- LiteSpeed ESI cache support for dynamic badge updates

### Automatic Unpublishing

[](#automatic-unpublishing)

- Cron job for automatically unpublishing expired service information
- Configurable action on expiration (draft or trash)
- WP-CLI command support: `wp service-info unpublish`
- Supports `--dry-run` and `--limit` options

### ACF Integration

[](#acf-integration)

- Settings page under Settings → Service Information
- Custom fields for:
    - Post data (start date, end date, unpublish settings)
    - Module settings (display options)
    - Taxonomy settings (icons per category)
    - General settings (archive page, URL slug, LiteSpeed ESI support, import schedule)

### External Importer System

[](#external-importer-system)

- Register external data sources to automatically import service information from third-party systems
- Importers run on a configurable cron schedule (hourly or daily), set under **Settings → Service Information**
- Each importer handles its own data fetching and maps it to a `ServiceInfoItem` DTO
- Idempotent upserts: existing posts are matched by source key + source ID and updated, not duplicated
- WP-CLI command: `wp service-info import [--importer=] [--dry-run]`

#### Registering a Custom Importer

[](#registering-a-custom-importer)

Implement `ModularityServiceInfo\Import\ImporterInterface`:

```
use ModularityServiceInfo\Import\ImporterInterface;
use ModularityServiceInfo\Import\ImporterRegistry;
use ModularityServiceInfo\Import\ServiceInfoItem;

class MyCustomImporter implements ImporterInterface
{
    public function getKey(): string
    {
        return 'my-source'; // slug-like, unique key used for deduplication
    }

    public function getName(): string
    {
        return 'My External Source';
    }

    public function import(): array
    {
        // Fetch data from your source and return ServiceInfoItem instances
        return [
            new ServiceInfoItem(
                sourceId: 'item-123',
                title: 'Water outage in district X',
                content: 'Planned maintenance work.',
                startDate: new \DateTimeImmutable('2026-03-15 08:00:00', new \DateTimeZone('UTC')),
                endDate: new \DateTimeImmutable('2026-03-15 17:00:00', new \DateTimeZone('UTC')),
                categories: ['Water'],
                unpublishDate: new \DateTimeImmutable('2026-03-15 18:00:00', new \DateTimeZone('UTC')),
                onUnpublish: 'trash',
                publishDate: null, // null = publish immediately
            ),
        ];
    }
}
```

Hook into `modularity_service_info_register_importers` to register your importer:

```
add_action('modularity_service_info_register_importers', function (ImporterRegistry $registry) {
    $registry->register(new MyCustomImporter());
});
```

#### `ServiceInfoItem` Fields

[](#serviceinfoitem-fields)

ParameterTypeRequiredDescription`sourceId``string`YesUnique ID from the source system, used for deduplication`title``string`YesPost title`content``string`YesPost content (HTML allowed)`startDate``DateTimeImmutable`YesWhen the service information becomes active`endDate``DateTimeImmutable|null`NoWhen it expires; `null` = no expiry`categories``string[]`NoTaxonomy term names for `service_category``unpublishDate``DateTimeImmutable|null`NoAuto-unpublish date (GMT/UTC); `null` = no auto-unpublish`onUnpublish``string`NoAction when unpublished: `'draft'` (default) or `'trash'``publishDate``DateTimeImmutable|null`NoPost publish date (GMT/UTC); `null` = publish immediately; future date = scheduled> **Note:** `unpublishDate` and `publishDate` must be expressed in GMT/UTC.

### Typesense Search Integration

[](#typesense-search-integration)

- Integrates with the Municipio Typesense search plugin
- Enriches indexed documents with formatted date range and icon name fields
- Registers a dedicated `service-info` hit template for search results
- Enqueues service info styles on search pages

### Developer Features

[](#developer-features)

- Filters for customizing behavior:
    - `Modularity/ServiceInformation/Posts/Slug` - Customize post type slug
    - `Modularity/ServiceInformation/Module/ArchiveLink/Icon` - Customize archive link icon
- Decorators for extending post meta functionality
- Validation handlers for ACF fields
- Cache busting for assets

Requirements
------------

[](#requirements)

- WordPress 6.0+
- [Modularity](https://github.com/helsingborg-stad/Modularity) 3.0+
- [Municipio](https://github.com/helsingborg-stad/Municipio) 6.0+ (recommended)
- Advanced Custom Fields PRO

Installation
------------

[](#installation)

1. Upload the plugin to `/wp-content/plugins/modularity-service-info/`
2. Activate the plugin through the WordPress admin
3. Configure settings under **Settings → Service Information**
4. Add the Service Info module to pages using Modularity

Configuration
-------------

[](#configuration)

### General Settings

[](#general-settings)

- **Archive Page**: Select a page to use as the service information archive
- **URL Slug**: Customize the permalink structure for service information posts
- **LiteSpeed ESI Cache**: Enable ESI support for menu badge (if running LiteSpeed)
- **Import Schedule**: How often to run registered external importers (`hourly`, `daily`, or disabled)

### Module Settings

[](#module-settings)

Configure display options when adding the module:

- Number of posts to display
- Show/hide category icons
- Enable archive link
- Group by categories

### Menu Badge

[](#menu-badge)

1. Go to **Appearance → Menus** or use the Customizer
2. Find "Service Information" in the menu items
3. Add it to your menu
4. The badge will automatically show the count of published service info posts

Usage
-----

[](#usage)

### Creating Service Information

[](#creating-service-information)

1. Go to **Service Information → Add New**
2. Enter title and content
3. Set the start and end dates
4. Optionally configure automatic unpublishing
5. Assign a service category
6. Publish

### Running Importers via WP-CLI

[](#running-importers-via-wp-cli)

Run all registered importers:

```
wp service-info import
```

Run a specific importer by key:

```
wp service-info import --importer=my-source
```

Preview what would be created/updated without writing to the database:

```
wp service-info import --dry-run
```

### Using the Module

[](#using-the-module)

1. Edit a page with Modularity
2. Add the "Service Information" module
3. Configure display settings
4. Save and publish

License
-------

[](#license)

MIT License - see [LICENSE](LICENSE) for details.

Author
------

[](#author)

[Consid Borås AB](https://github.com/considbrs-webdev)

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance61

Regular maintenance activity

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 71.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18331514?v=4)[Michael Claesson](/maintainers/michaelclaesson)[@michaelclaesson](https://github.com/michaelclaesson)

---

Top Contributors

[![michaelclaesson](https://avatars.githubusercontent.com/u/18331514?v=4)](https://github.com/michaelclaesson "michaelclaesson (28 commits)")[![WilliamLundqvist](https://avatars.githubusercontent.com/u/157830304?v=4)](https://github.com/WilliamLundqvist "WilliamLundqvist (10 commits)")[![viktor7ltz](https://avatars.githubusercontent.com/u/78755786?v=4)](https://github.com/viktor7ltz "viktor7ltz (1 commits)")

### Embed Badge

![Health badge](/badges/considbrs-webdev-modularity-service-info/health.svg)

```
[![Health](https://phpackages.com/badges/considbrs-webdev-modularity-service-info/health.svg)](https://phpackages.com/packages/considbrs-webdev-modularity-service-info)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
