Building “The Jet Pack” for Craft CMS
Image credit: pixabay
Nomenclature for the assembly
Like the parts of a Jet Pack, parts of the plugin should be named in a consistent format so that they can be identified easily. We follow the naming guidelines whether we’re naming packages or handles. It is safe and efficient to follow a particular nomenclature.According to the Craft’s documentation-
- Plugin handle must have lowercase letters, numbers, and dashes. All in Kebab case
- Package name should have Craft- prefixed to it, after the ‘/’
Creating blueprint for “The Jet Pack”
Image credit: matej
Before we found out about pluginfactory, like every other developer we used to make our plugin structure manually. Pluginfactory creates a skeleton for your plugin in just a few clicks. It is created by a Craft developer named Andrew Welch. The scaffolding on pluginfactory are made using the Yeoman generator.Details needed to create the scaffolding
- API version
- Plugin name
- Description
- Initial version
- Plugin vendor
- Plugin author
- Author URL
- Github name
Installing “The Jet Pack”
Image credit: jaguarmena
Plugins are written as composer packages. For Craft to recognize the plugin we have to install it as a composer dependency of the project. The installation depends on the nature of plugin whether it’s local or public. If it’s local we install it by configuring the composer.json and adding a new path repository record. The path must point toward the plugin’s root. If a plugin is made for a public release then it can also be installed directly via composer. After registering the plugin as a new composer package on Packagist, a require package command in composer fetches the package and installs it.Final word: Plugins are essential
Image credit: jaguarmena
Plugins are not a crucial part of a CMS but it sure is important to achieve something out of the box based on client’s requirement. We find plugins to be extremely powerful and time-saving. The most important function of a plugin is to eliminate tedious and repetitive tasks by automating it. Some examples might put its importance into perspective.- SEO plugins make search engine optimization easier
- E-commerce plugins improve customer journey.
- Analytic plugins help with insights on page performance
- Text and image editor plugins provide rich editing functionalities