Skip to content

Opinionated Mezzio/Prismic application setup for new website projects

License

Notifications You must be signed in to change notification settings

netglue/primo-skeleton

Repository files navigation

Mezzio/Prismic Skeleton

PHPUnit Test Suite codecov

You can see this app running in its default state (Including a whole load of documentation) at https://primo.ngio.uk

This skeleton is opinionated in order to supply quite a bit of functionality out of the box without too much complexity.

Importantly, it's the product of the Mezzio Skeleton, and using it is contingent on understanding Prismic - a headless CMS service and some familiarity with the following dependencies will be very useful:

Templating laminas-view
DI Container laminas-servicemanager
Routing fastroute
PSR Event Dispatcher phly/event-dispatcher
PSR Cache laminas-cache
PSR Logger monolog
PSR HTTP Client httplug

Rudimentary Frontend Asset Compilation

After running npm install, if ./node_modules/.bin is on your $PATH, you'll be able to issue npm-watch, otherwise, put it on your $PATH or type the full path to npm-watch.

If you look at package.json, and the resources in ./frontend you'll see that scss, js and prismic document type definitions are compiled by npm scripts.

Styles are intentionally empty and intended to be a starting point for a completely new website. Similarly JS is just an iif triggered on load.

Prismic document types are compiled with netglue/prismic-cli via node and there's a page type setup that can be used as starting point to build your own types. Take a look in ./config/autoload/prismic-cli.global.php for relevant configuration of the tool.

To disable development mode

$ composer development-disable

Development mode status

$ composer development-status

Configuration caching

By default, the skeleton will create a configuration cache in data/config-cache.php. When in development mode, the configuration cache is disabled, and switching in and out of development mode will remove the configuration cache.

You may need to clear the configuration cache in production when deploying if you deploy to the same directory. You may do so using the following:

$ composer clear-config-cache

You may also change the location of the configuration cache itself by editing the config/config.php file and changing the config_cache_path entry of the local $cacheConfig variable.