A ZF2 module that provides common functionality for public websites
- php: >=5.3.3
- zendframework/zendframework: ~2.3
- phpunit/phpunit: 3.*
- zendframework/zend-developer-tools: dev-master
This package is auto-updated.
Last update: 2021-09-02 12:04:07 UTC
Work In Progress
If you use this package, bear in mind it's developed mainly for our own use at Netglue so minor version bumps will very possibly have BC Breaks. Generally, patch versions will remain as stable as it was before.
This is a simple module to configure utility stuff that's used for the majority of my public websites.
Simply install with composer, add to your module list and you've got working routes for common files.
View Rendering Strategies
Plain text and XML view rendering strategies are registed with the view manager so that you can easily template these types of content using the standard templating system.
From your controller, all you have to do to use them is return a
XmlModel and make sure that a template is available to render that can be found in your path stack or template map.
The xml and text view models are marked as terminal so layouts won't be rendered. The models also set the default
content-type header appropriately and use UTF-8 by default.
Defaults Controller with Initial Routes
There are a few routes that are useful for simple public sites.
- Google Verification at
- XML Sitemap from the default navigation container at
- HTML Site Map at
- Robots Text at
The google verification endpoint uses the
SiteData view helper which is a simple wrapper around
View Manager Boilerplate and Error views
I often don't start with a Skeleton app so having this already setup is helpful to me.
Error Listener, Layout Switcher
By default a listener is configured to watch out for the events
MvcEvent::EVENT_RENDER_ERROR and set the view layout template when an error occurs.
The following config options are relevant here:
$config['view_manager']['use_error_layout'] = true; $config['view_manager']['error_layout'] = 'layout/error';
Whatever layout template is set needs to be resolvable in the template path stack or map.
Install with composer:
netglue/public-website-defaults-module as a dependency in a ZF2 app.
Add to your list of modules with the name
Take a look at
- Fixed a serious problem where the custom renderers would steal the view helper plugin manager, thereby making
$this->partial()fail to find any of the expected templates. Solved this by throwing out the custom renderers and template resolvers.
- The Google verify controller action will appropriately throw a 404 when no verification code is configured, or the requested url doesn't match the configured file.
- Removed all reference to Nibbler verification as it's been discontinued.
- Added a default error listener that switches layout when there's one of
MvcEvent::EVENT_RENDER_ERRORproviding we have a regular view model as opposed to a console view model.
- Fixing my screw up with composer and repo tags
- Initial Release