Download the PHP package contenir/contenir-view-helper without Composer
On this page you can find all versions of the php package contenir/contenir-view-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download contenir/contenir-view-helper
More information about contenir/contenir-view-helper
Files in contenir/contenir-view-helper
Package contenir-view-helper
Short Description Contenir View components
License BSD-3-Clause
Homepage https://contenir.com.au
Informations about the package contenir-view-helper
contenir/contenir-view-helper
laminas-view helpers shared by Contenir CMS sites: text formatting, links, media embeds, BEM form groups, and access to the application's ACL, settings and view cache from view scripts.
Requirements
- PHP 8.3, 8.4 or 8.5
- laminas-view 2.35+, laminas-form 3.21+, laminas-cache 3.12+
laminas/laminas-i18nwhen you useformGroup(), as the laminas-form view helpers it renders through need it
The 1.x releases, which support PHP 8.0 to 8.2, remain available from the
1.x branch and v1.* tags; see UPGRADE-2.0.md.
Installation
With the Laminas component installer, the Contenir\View module (laminas-mvc)
or Contenir\View\ConfigProvider (Mezzio) registers itself. Otherwise add
Contenir\View to config/modules.config.php, or the ConfigProvider to
your config aggregator.
Usage
Every helper is registered under its class name and a camelCase and
PascalCase alias, so view scripts call $this->truncate(...) or
$this->Truncate(...).
| Helper | Purpose | Docs |
|---|---|---|
dateFormat($date = null, $format = null) |
Format a date string (d M Y by default); null when unparseable |
Text |
truncate($text, $length = 125, $strip = false, $etc = '...', $breakWords = false, $middle = false) |
Shorten text at a word boundary | Text |
fileSize($bytes, $decimals = 2, $system = FileSize::SYSTEM_METRIC) |
1.5MB, or 1.5MiB in the binary system |
Text |
fileType($mimeType) |
PDF or Document |
Text |
richContent($html, $template = []) |
Lay out __SECTION__ / __COL__ markers as grid sections and columns |
Text |
urlFormat($url = null, $format = null) |
Normalise a URL and render chosen parts | Links |
resourceLink($value = null, $defaultCta = null) |
Normalise a CMS link field into link objects | Links |
socialLink($network, $handleOrUrl, $options = []) |
Link to a social network profile | Links |
escapeEmail($email, $mailto = false) |
Obfuscate an email address against harvesters | Links |
image($path, $attributes = [], $pictureAttributes = []) |
Lazy-loaded <picture> served from a CDN |
Media |
srcset($path, $sizes = []) |
srcset value for pre-resized derivatives |
Media |
video($path, $options = [], $controls = false) |
Vimeo/YouTube embed or <video> element |
Media |
icon($name, $options = []) |
Inline an SVG icon | Media |
formGroup($element, $displayAttributes = [], $groupAttributes = [...]) |
Render a laminas-form element as a BEM form group | Forms |
acl(), settings(), cache() |
The application's ACL, settings and view cache | Application services |
All helper classes are final. To customise one, register your own helper
under the same alias; see Customising a helper.
Configuration
| Key | Used by | Default |
|---|---|---|
view_cdn.host, view_cdn.method |
image() |
no host; https |
view_helper_config.icon.class |
icon() default wrapper class |
none (icon output bare) |
settings |
settings() |
[] |
service ViewCache (a laminas-cache StorageInterface) |
cache() |
required to use cache() |
service Application\Acl\Acl (an AclInterface) |
acl() |
required to use acl() |
The laminas-mvc Module also sets shared view_manager defaults: an HTML5
doctype, error/404, error/403 and error/index templates, and the JSON
view strategy. See Configuration.
Development
The QA toolchain is php-db/phpdb-qa-tools.
Mago is a standalone binary, installed
separately (brew install mago).
License
BSD-3-Clause. See LICENSE.md.
All versions of contenir-view-helper with dependencies
laminas/laminas-cache Version ^3.12
laminas/laminas-cache-storage-adapter-filesystem Version ^2.4
laminas/laminas-config Version ^3.9
laminas/laminas-escaper Version ^2.13
laminas/laminas-form Version ^3.21
laminas/laminas-permissions-acl Version ^2.16
laminas/laminas-servicemanager Version ^3.22 || ^4.0
laminas/laminas-uri Version ^2.12
laminas/laminas-view Version ^2.35
psr/container Version ^1.1 || ^2.0