Download the PHP package contenir/contenir-resource-mezzio without Composer
On this page you can find all versions of the php package contenir/contenir-resource-mezzio. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download contenir/contenir-resource-mezzio
More information about contenir/contenir-resource-mezzio
Files in contenir/contenir-resource-mezzio
Package contenir-resource-mezzio
Short Description Mezzio adapter for contenir/contenir-resource: workflow routing and navigation for Contenir resources, a middleware that resolves the routed resource and its page metadata, resource URLs and optional laminas-view helpers.
License BSD-3-Clause
Homepage https://contenir.com.au
Informations about the package contenir-resource-mezzio
contenir/contenir-resource-mezzio
The Mezzio adapter for contenir/contenir-resource, so a Mezzio site that does not run the full Contenir CMS can serve Contenir resources (pages, articles, collections):
- routes and navigation built from the resource tree through contenir-workflow-mezzio;
- a PSR-15 middleware that resolves the routed resource, refuses unpublished ones, and attaches the resource and its page metadata to the request;
- resource URLs through the Mezzio router, and safe editor-entered links;
- section summaries rendered through
mezzio/mezzio-template; - optional laminas-view helpers (
resource,resourceMeta,resourceUrl,resourceContent) for mezzio-laminasviewrenderer sites.
The entities, repositories, resource manager and metadata builder live in contenir/contenir-resource and are framework neutral; this package is the Mezzio plumbing around them. It replaces the laminas-mvc parts of contenir/contenir-resource 1.x; see Coming from contenir-resource 1.x.
Requirements
- PHP 8.3, 8.4 or 8.5
- contenir/contenir-resource 2.x (with contenir/contenir-db-model 2.x), contenir/contenir-workflow-mezzio 2.1+
- mezzio/mezzio 3.18+, mezzio/mezzio-router, mezzio/mezzio-template
- laminas/laminas-view 2.36+ only for the optional view helpers
Install
2.0 is a release candidate (2.0.0-RC1): contenir-db-model 2 is itself at RC and builds on php-db/phpdb 0.6, which
has no stable release yet. Composer only honours stability flags in the root package, so a site needs these in its
own composer.json:
Alternatively set "minimum-stability": "dev" with "prefer-stable": true in the site's composer.json and
require contenir/contenir-resource-mezzio normally.
With laminas-component-installer the config providers are added automatically. Otherwise register all of them:
Wiring
1. Route resources through a workflow
Each resource is routed by the workflow plugin named in its workflow column (page when empty). The default
PageWorkflow has no handler, so register your own:
and add it to the WorkflowPluginManager (for example as the page alias). See Routing and navigation.
2. Pipe the middleware after routing
3. Use the resource in the handler
What is in the package
| Class | Purpose |
|---|---|
Workflow\ResourceStrategy |
workflow-mezzio strategy: workflow from the workflow column; navigation label, visibility and lastmod from the resource |
Workflow\ResourceTreeAdapter |
workflow-mezzio resource adapter over ResourceRepository::findPageTree() |
Workflow\ResourceTypesAdapter |
workflow-mezzio resource adapter over every published resource of the types workflow_manager.resource_types lists (default ['page']), wherever each sits |
Workflow\WorkflowResource |
A resource entity presented as a workflow-mezzio ResourceInterface |
Middleware\ResourceMiddleware |
Resolves the routed resource; 404s missing or unpublished ones; attaches resource and PageMetadata |
ResourceAttribute |
Reads the attached resource (resource(), require()) and metadata (metadata()) |
Url\ResourceUrlGenerator |
Resource links through the router, editor-entered links through ExternalUrl |
Content\TemplateSectionRenderer |
Renders section content with the template renderer, for ResourceSummary |
Preview\WorkflowPageResolver |
Which middleware shows a page the CMS previews |
View\Helper\ResourceHelper, ResourceMetaHelper, ResourceUrlHelper, ResourceContentHelper |
Optional laminas-view helpers |
ConfigProvider, Container\*Factory |
Container wiring |
Every concrete class is final. The docs cover each area:
- Routing and navigation
- The resource middleware
- Metadata, templates and links
- laminas-view helpers
- CMS previews
- Configuration
- Coming from contenir-resource 1.x (laminas-mvc)
Security
- Unpublished pages. The route cache can outlive a change in the admin. The middleware re-checks every routed resource and answers missing, pending, inactive or archived ones with the not-found handler; the page handler never sees them.
- Request input. Only an array
idroute default with aresourceIdkey is treated as a resource route, so a path placeholder calledidcan never trigger a lookup; ids other than positive integers never reach the database. - Host header. Set
contenir_resource.base_urlin production; otherwise canonical and Open Graph URLs use the request's host, which the client controls. Query strings never reach canonical or share URLs. - Links and images. Editor-entered links and share images are limited to safe schemes;
javascript:,data:and the like are dropped. - Escaping.
MetaTagRendererand the laminas-view head helpers escape everything; summaries and link pairs are plain text that templates must escape.
Development
The QA toolchain is contenir/contenir-qa-tools.
Mago is a standalone binary, installed separately (brew install mago).
License
BSD-3-Clause. See LICENSE.md.
All versions of contenir-resource-mezzio with dependencies
contenir/contenir-db-model Version ^2.0.0-rc5
contenir/contenir-metadata Version ^2.0
contenir/contenir-resource Version ^2.0.0-RC8
contenir/contenir-workflow-mezzio Version ^2.1
laminas/laminas-cache Version ^3.12
laminas/laminas-servicemanager Version ^3.22
mezzio/mezzio Version ^3.18
mezzio/mezzio-router Version ^3.17
mezzio/mezzio-template Version ^2.10
psr/container Version ^1.1 || ^2.0
psr/http-message Version ^1.1 || ^2.0
psr/http-server-handler Version ^1.0.2
psr/http-server-middleware Version ^1.0.2