Get the FREE Ultimate OpenClaw Setup Guide →

building-packages

npx machina-cli add skill MacareuxDigital/concretecms-skills/building-packages --openclaw
Files (1)
SKILL.md
2.3 KB

Building Packages

Concrete CMS packages are modular components that extend the functionality of the platform. This skill is essential for developers who want to create custom functionality or integrate third-party services into their Concrete CMS projects.

Basic Workflow for Package Development

Follow these steps to develop a custom package in Concrete CMS:

  1. Initialize the Package Directory: Create a new directory under packages/ with a lowercase, underscore-separated name (e.g., packages/my_custom_package).
  2. Create the Package Controller: Create a controller.php file in the package root. Define the package handle, version, and basic information.
  3. Implement Installation Logic: In the install() method of your controller, add code to register block types, themes, single pages, or other entities.
  4. Add Custom Functionality:
  5. Install the Package: Use the Concrete CMS Dashboard or CLI (concrete/bin/concrete c5:package:install my_custom_package) to install your package.
  6. Update and Refine: When making changes to the package structure (like adding a new block type), update the $pkgVersion in controller.php, implement the upgrade() method, and run the update from the Dashboard or CLI (concrete/bin/concrete c5:package:update my_custom_package).

Reference Documentation

Source

git clone https://github.com/MacareuxDigital/concretecms-skills/blob/main/building-packages/SKILL.mdView on GitHub

Overview

Concrete CMS packages extend functionality by modular components. This skill guides developers to create custom packages or manage existing ones, enabling reuse across projects and integration of services. It covers package structure, installation logic, and lifecycle management.

How This Skill Works

Begin by creating a package directory under packages/ with a lowercase, underscore-separated name. Add a package controller.php to declare the package handle, version, and basic info, then implement install() to register entities like blocks, themes, and single pages. Install the package via the CMS Dashboard or the CLI, and update the package by bumping $pkgVersion and implementing upgrade() as you refine structure or features.

When to Use It

  • You need to create a reusable feature set for multiple sites as a packaged solution.
  • You want to ship new blocks, themes, or single pages as a cohesive package.
  • You are integrating third-party services via a Concrete CMS package.
  • You need to update or refine a package’s structure or functionality and manage upgrades.
  • You want to install a package using the Concrete CMS Dashboard or CLI.

Quick Start

  1. Step 1: Initialize the Package Directory: create packages/my_custom_package with a lowercase, underscore-separated name.
  2. Step 2: Create the Package Controller: add controller.php and define the package handle, version, and basic information.
  3. Step 3: Install and Extend: implement install() to register entities, add functionality, and install via Dashboard or CLI.

Best Practices

  • Name the package directory under packages/ with lowercase, underscore-separated naming (e.g., packages/my_custom_package).
  • Define a clear package handle, version, and basic information in controller.php.
  • Use install() to register blocks, themes, single pages, or other entities during package installation.
  • Extend core classes and manage routes/services through referenced guidelines; coordinate with building-blocktypes and building-singlepages as needed.
  • When changing structure, bump $pkgVersion, implement upgrade(), and test updates via the Dashboard or CLI (c5:package:update).

Example Use Cases

  • Create a package named my_custom_package that adds a new block type and a corresponding single page for a custom workflow.
  • Package an integration with a third-party service, including custom routes and a service provider for wiring endpoints.
  • Distribute a package that extends core classes to alter default behavior across sites staying within Concrete CMS guidelines.
  • Update an existing package by increasing $pkgVersion and implementing an upgrade() path for seamless migrations.
  • Install a prepared package via the Concrete CMS Dashboard or using the CLI command concrete c5:package:install my_custom_package.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers