PHPackages                             samsoncms/template - 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. [Templating &amp; Views](/categories/templating)
4. /
5. samsoncms/template

ActiveLibrary[Templating &amp; Views](/categories/templating)

samsoncms/template
==================

SamsonCMS base template

0.0.5(9y ago)13.6k5[7 issues](https://github.com/samsoncms/template/issues)2Open Software License (OSL) v 3.0CSS

Since Jul 19Pushed 9y ago1 watchersCompare

[ Source](https://github.com/samsoncms/template)[ Packagist](https://packagist.org/packages/samsoncms/template)[ Docs](http://samsonos.com/)[ RSS](/packages/samsoncms-template/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (5)Versions (6)Used By (2)

SamsonCMS generic template module
=================================

[](#samsoncms-generic-template-module)

[![Latest Stable Version](https://camo.githubusercontent.com/114afa1492e69faa5ff77f8ecdbc75fc4729759881ed2e990e7c5bc06d694dc6/68747470733a2f2f706f7365722e707567782e6f72672f73616d736f6e636d732f74656d706c6174652f762f737461626c652e737667)](https://packagist.org/packages/samsoncms/template)[![Build Status](https://camo.githubusercontent.com/c3af2b0e24850126916c82b4b3a64d3b5da415096a490c7efd4e1fa40dd5f81d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e636d732f74656d706c6174652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsoncms/template/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/134531b11c4a6ec1e628b6ae4c038ca8925c3013cfa29a1a8b9ec1347ce25e73/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e636d732f74656d706c6174652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsoncms/template/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/db61cddf50d4b819bdcd49e729a103a8cf2fd7ba9371d9143203b27d004817b6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e636d732f74656d706c6174652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsoncms/template/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/750aba8f8a5a887ac6a0b3094efdf84bfd575dd92d81dd7ba5a99e9f2bbc7ce8/68747470733a2f2f706f7365722e707567782e6f72672f73616d736f6e636d732f74656d706c6174652f646f776e6c6f6164732e737667)](https://packagist.org/packages/samsoncms/template)[![Stories in Ready](https://camo.githubusercontent.com/59eee62f249f2878e0ceda4e6fb735a9c88aa2938aebd9256cd557b17062805f/68747470733a2f2f62616467652e776166666c652e696f2f73616d736f6e636d732f74656d706c6174652e706e673f6c6162656c3d7265616479267469746c653d5265616479)](https://waffle.io/samsoncms/template)

This module is responsible for rendering base HTML template, its styles, icons and images.

All template styles is created with LESS, every entity has it `vars.less`.

This module should define HTML structure of SamsonCMS, its building blocks and entities which should be used in all other SamsonCMS modules and applications.

This template is basic and included in a SamsonCMS bootstrap, but can be easily changed by custom or modified once, the only limitation that must be met is template structure and its events, as all SamsonCMS ecosystem is based on this structure and entities.

Template is using [Font-Awesome](http://fortawesome.github.io/Font-Awesome/) for all icons.

Events
------

[](#events)

All structure blocks have Events(), and all their filling and rendering should be done via this events.

Template structure
------------------

[](#template-structure)

This base SamsonCMS template structure can be defined as next:

- Menu section `.template-menu`
- Sub-menu section `.template-sub-menu`
- Container section `.template-container`

### Template menu structure

[](#template-menu-structure)

Index view is located `www/menu/index.vphp`, menu item view is located `www/menu/item.vphp`

- `.template-menu`
    - `.template-menu-list`
        - `.text` Added `.active` if item is active
            - `.item` or `.item` (for .active element as it cannot be clicked)
            - `` For icons (do not use it if no icon is needed)
            - `` For item text (do not use it if no text is needed)

### Template sub-menu structure

[](#template-sub-menu-structure)

Index view is located `www/menu/index.vphp`, menu item view is located `www/menu/item.vphp`

- `.template-sub-menu`
    - `.template-sub-menu-list`
        - `.collapser` For showing/hiding sub-menu
        - `` You can use any inner item structure

### Menu events

[](#menu-events)

#### Menu created event - `template.menu.started: &$html, &$submenu`

[](#menu-created-event---templatemenustarted-html-submenu)

This event fires before generic menu rendering process has started. Before menu started default template menu item would be automatically added:

- Main page item
- Go to site item So in your event you will already receive not an empty menu `$html`, this gives you ability to remove this default items or change them.

For rendering sub-menu section you need to fill `$submenu` in your event handler.

#### Menu rendered event - `template.menu.rendered: &$html, &$submenu`

[](#menu-rendered-event---templatemenurendered-html-submenu)

This event fires when all menu inner items has been rendered into main container.

#### Menu event handler example

[](#menu-event-handler-example)

This is a modified old approach menu &amp; sub-menu render integrated via new menu events

```
function oldMenuRenderer(&$html, &$subMenu)
{
    // Iterate loaded samson\cms\application
    foreach (\samson\cms\App::loaded() as $app) {
        // Show only visible apps
        if ($app->hide == false) {
            // Render application menu item
            $html .= m('template')
                ->view('menu/item')
                ->active(url()->module == $app->id() ? 'active' : '')
                ->app($app)
                ->icon($app->icon)
                ->name(isset($app->name{0}) ? $app->name : (isset($app->app_name{0}) ? $app->app_name : ''))
                ->output();
        }
    }

    $subMenu = '';

    // Find current SamsonCMS application
    if (\samson\cms\App::find(url()->module, $app/*@var $app App*/)) {
        // Render main-menu application sub-menu
        $subMenu = $app->submenu();

        // If module has sub_menu view - render it
        if ($app->findView('sub_menu')) {
            $subMenu .= $app->view('sub_menu')->output();
        }
    }
}
```

### Template container structure

[](#template-container-structure)

All elements inside container must be inside `.template-block`

- `.template-container`
    - `.template-block`

#### Template container form structure

[](#template-container-form-structure)

- `.template-form` Should be used for all forms
    - `.template-form-group` - Form row
        - `.template-form-input` - Form input field
            - `.template-form-input-field`
            - `.template-form-input-placeholder` Used instead of standard placeholder

### Container events

[](#container-events)

#### Main page created event - `template.main.created`

[](#main-page-created-event---templatemaincreated)

This event fires before main page rendering process has started.

#### Main page rendered event - `template.main.rendered`

[](#main-page-rendered-event---templatemainrendered)

This event fires when main page has been rendered into main container.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.3% 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.

###  Release Activity

Cadence

Every ~7 days

Total

5

Last Release

3608d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0be8756efdc8f599b8fe9261bed31570d0f140a3b921f0f891877a9133ad654c?d=identicon)[samsonos](/maintainers/samsonos)

---

Top Contributors

[![vitalyiegorov](https://avatars.githubusercontent.com/u/586558?v=4)](https://github.com/vitalyiegorov "vitalyiegorov (189 commits)")[![getmanenko](https://avatars.githubusercontent.com/u/14871360?v=4)](https://github.com/getmanenko "getmanenko (27 commits)")[![expenect](https://avatars.githubusercontent.com/u/10962934?v=4)](https://github.com/expenect "expenect (20 commits)")[![nik-os](https://avatars.githubusercontent.com/u/7326967?v=4)](https://github.com/nik-os "nik-os (12 commits)")[![onysko](https://avatars.githubusercontent.com/u/7703953?v=4)](https://github.com/onysko "onysko (9 commits)")[![rmolodyko](https://avatars.githubusercontent.com/u/4399482?v=4)](https://github.com/rmolodyko "rmolodyko (1 commits)")

---

Tags

samsoncms templatesamsoncms structure

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/samsoncms-template/health.svg)

```
[![Health](https://phpackages.com/badges/samsoncms-template/health.svg)](https://phpackages.com/packages/samsoncms-template)
```

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3851.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.1k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.3k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

282.2k](/packages/webkinder-sproutset)

PHPackages © 2026

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