locomotivemtl/charcoal-cms

Charcoal CMS (Content Management System) Module


README

The CMS Charcoal Module (Content Management System). Provides basic objects to build a website. Notably, Section (or page), News, Event and Faq as well as to ather user data, notably ContactInquiry.

This module is heavily dependant on charcoal-object (and therefore charcoal-core) which provides the base Content class the CMS objects are dependant on, as well as many trait / interface behaviors.

How to install

The preferred (and only supported) way of installing charcoal-cms is with composer:

★ composer require locomotivemtl/charcoal-cms

For a complete, ready-to-use project, start from the charcoal project boilerplate:

★ composer create-project locomotivemtl/charcoal-project-boilerplate:@dev --prefer-source

Dependencies

Recommended dependencies

Objects

Core objects

Section object

A section, in Charcoal, is a reachable page on the website, as part of the full hierarchical site map. They can be displayed in menus or breadcrumbs and be reached with a unique URL (routable).

Types of sections:

  • blocks
    • Blocks sections define their content as a structured map of blocks.
  • content
    • Content sections define their content in a single, simple HTML property.
  • empty
    • Empty sections are linked to a template but do not require any custom content.
  • external
    • External sections are simply a redirect to an external (or internal) URL.

All section types, except external, make use of a Template object to be rendered. Typically, a charcoal view make sure of linking the template (by default, mustache

Sections are standard Charcoal Model, meaning they are describable with a Metadata object (which define a map of properties) and storable with a Source object.

Base section properties:

Interfaces

From model:

  • Describable: The objects can be defined by Metadata.
  • Storable: Objects have unique IDs and can be stored in storage / database.

From content:

  • Content: A "managed" charcoal model (describable with metadata / storable).
  • Authorable: Creation and modification user (admin) are kept in the storage.
  • Revisionable: Copy of changes will be kept upon each object update in the storage.
  • Timestampable: Creation and modification time are kept into the storage.

From charcoal-object

  • Hierarchicale: The objects can be stacked hierarchically.
  • Publishable: Objects have publish status, date and expiry. Allows moderation.
  • Routable: Objects are reachable through a URL.

From charcoal-cms:

  • Metatag: The objects have meta-information for SEO purpose.
  • Searchable: Extra keywords can be used to help search engine.
  • Templateable: The objects can be rendered with a template / controller / config combo.

Extending the section object

The \Charcoal\Cms\Section\* objects are final. To extend, use the \Charcoal\Cms\AbstractSection base object instead, to make sure no metadata conflicts arise.

Tag object

Tag objects link any objects together by providing an extra taxonomy layer. Tags may also be used to enhance internal search engines.

CMS objects

Event object

Charcoal Event is a specialized content object to describe an event, which typically happens at a given date in a certain location.

Base events properties:

Interfaces

From model:

  • Describable: The objects can be defined by Metadata.
  • Storable: Objects have unique IDs and can be stored in storage / database.

From content:

  • Content: A "managed" charcoal model (describable with metadata / storable).
  • Authorable: Creation and modification user (admin) are kept in the storage.
  • Revisionable: Copy of changes will be kept upon each object update in the storage.
  • Timestampable: Creation and modification time are kept into the storage.

From charcoal-object:

  • Categorizable: The objects can be put into a category.
  • Publishable: Objects have publish status, date and expiry. Allows moderation.
  • Routable: Objects are reachable through a URL.

From charcoal-cms:

  • Metatag: The objects have meta-information for SEO purpose.
  • Searchable: Extra keywords can be used to help search engine.
  • Templateable: The objects can be rendered with a template / controller / config combo.

Extending the event object

The \Charcoal\Cms\Event object is final. To extend, use the \Charcoal\Cms\AbstractEvent base object instead, to make sure no metadata conflicts arise.

Event categories

Event category objects are simple charcoal/object/category used to group / categorize events. The default type is Charcoal\Cms\EventCategory.

Events implement the Categorizable interface, from charcoal-object.

FAQ object

FAQ objects are a special content type that is split in a "question" / "answer" format.

FAQ categories

FAQ category objects are simple charcoal/object/category used to group / categorize FAQ objects. The default type is Charcoal\Cms\FaqCategory.

FAQs implement the Categorizable interface, from charcoal-object.

News object

News object are a special content type that with a specific news date.

Base news properties:

Interfaces

From model:

  • Describable: The objects can be defined by Metadata.
  • Storable: Objects have unique IDs and can be stored in storage / database.

From content:

  • Content: A "managed" charcoal model (describable with metadata / storable).
  • Authorable: Creation and modification user (admin) are kept in the storage.
  • Revisionable: Copy of changes will be kept upon each object update in the storage.
  • Timestampable: Creation and modification time are kept into the storage.

From charcoal-object:

  • Categorizable: The objects can be put into a category.
  • Publishable: Objects have publish status, date and expiry. Allows moderation.
  • Routable: Objects are reachable through a URL.

From charcoal-cms:

  • Metatag: The objects have meta-information for SEO purpose.
  • Searchable: Extra keywords can be used to help search engine.
  • Templateable: The objects can be rendered with a template / controller / config combo.

Extending the news object

The \Charcoal\Cms\News object is final. To extend, use the \Charcoal\Cms\AbstractNews base object instead, to make sure no metadata conflicts arise.

News categories

News category objects are simple charcoal/object/category used to group / categorize events. The default type is Charcoal\Cms\NewsCategory.

News implement the Categorizable interface, from charcoal-object.

Development

To install the development environment:

$ composer install --prefer-source

API documentation

Development dependencies

  • phpunit/phpunit
  • squizlabs/php_codesniffer
  • satooshi/php-coveralls

Continuous Integration

Coding Style

The charcoal-cms module follows the Charcoal coding-style:

Coding style validation / enforcement can be performed with composer phpcs. An auto-fixer is also available with composer phpcbf.

Authors

License

Charcoal is licensed under the MIT license. See LICENSE for details.