wheels plugin init
Initialize a new CFWheels plugin in the /plugins directory.
Usage
wheels plugin init <name> [--author=<name>] [--description=<text>] [--version=<version>] [--license=<type>]Parameters
name
Yes
string
-
-
Plugin name (will be prefixed with 'wheels-')
author
No
string
-
""
Plugin author name
description
No
string
-
""
Plugin description
version
No
string
-
"1.0.0"
Initial version number
license
No
string
MIT, Apache-2.0, GPL-3.0, BSD-3-Clause, ISC, Proprietary
MIT
License type
Description
The plugin init command creates a new CFWheels plugin following the standard CFWheels plugin structure. The plugin is created directly in your application's /plugins directory and includes all necessary files to get started.
Features
Creates plugin in
/pluginsdirectoryFollows CFWheels plugin conventions
Includes
mixin="global"for framework-wide availabilityGenerates documentation files
Includes test suite
Ready for ForgeBox publishing
Examples
Basic plugin initialization
wheels plugin init my-helperOutput:
===========================================================
  Initializing Wheels Plugin: wheels-my-helper
===========================================================
Creating plugin in /plugins/myHelper/...
===========================================================
[OK] Plugin created successfully in /plugins/myHelper/
Files Created:
  myHelper.cfc      Main plugin component
  index.cfm         Documentation page
  box.json          Package metadata
  README.md         Project documentation
Next Steps:
  1. Edit myHelper.cfc to add your plugin functions
  2. Update index.cfm and README.md with usage examples
  3. Test: wheels reload (then call your functions)
  4. Publish: box login && box publishWith full metadata
wheels plugin init authentication \
  --author="Jane Smith" \
  --description="Authentication and authorization system" \
  --version="0.1.0" \
  --license=MITQuick initialization
wheels plugin init api-tools --author="DevTeam"Generated Structure
The command creates the following structure in /plugins/pluginName/:
plugins/
└── myHelper/
    ├── box.json           Package configuration
    ├── myHelper.cfc       Main plugin component (mixin="global")
    ├── index.cfm          Plugin documentation page
    ├── README.md          Project documentation
    ├── .gitignore         Git ignore file
    └── tests/             Test suite
        └── myHelperTest.cfc   TestBox testsFile Templates
myHelper.cfc (Main Plugin Component)
component hint="wheels-my-helper" output="false" mixin="global" {
    public function init() {
        this.version = "1.0.0";
        return this;
    }
    /**
     * Example function - Add your plugin methods here
     *
     * [section: Plugins]
     * [category: myHelper]
     *
     * @param1 Description of parameter
     */
    public function myHelperExample(required string param1) {
        // Your plugin logic here
        return arguments.param1;
    }
}Key Features:
mixin="global"makes functions available everywhere in WheelsFunctions documented with Wheels doc format
[section: Plugins]Version tracking via
this.version
index.cfm (Documentation Page)
<h1>wheels-my-helper</h1>
<p>Plugin description</p>
<h3>Installation</h3>
<pre>
wheels plugin install wheels-my-helper
</pre>
<h3>Usage</h3>
<h4>Example Function</h4>
<pre>
// Call the example function
result = myHelperExample("test");
</pre>box.json (Package Metadata)
{
    "name": "wheels-my-helper",
    "version": "1.0.0",
    "author": "Your Name",
    "slug": "wheels-my-helper",
    "type": "cfwheels-plugins",
    "keywords": "cfwheels,wheels,plugin",
    "homepage": "",
    "shortDescription": "Plugin description",
    "private": false
}Development Workflow
1. Initialize Plugin
wheels plugin init my-helper --author="Your Name"2. Add Your Functions
Edit /plugins/myHelper/myHelper.cfc and add your plugin methods:
public function formatCurrency(required numeric amount) {
    return dollarFormat(arguments.amount);
}
public function slugify(required string text) {
    return lCase(reReplace(arguments.text, "[^a-zA-Z0-9]+", "-", "all"));
}3. Update Documentation
Edit index.cfm and README.md with usage examples and function descriptions.
4. Test Your Plugin
wheels reloadThen in your Wheels application:
// Your functions are now available everywhere
formatted = formatCurrency(1234.56);  // Returns "$1,234.56"
slug = slugify("My Blog Post");       // Returns "my-blog-post"5. Add Tests
Edit /plugins/myHelper/tests/myHelperTest.cfc:
it("should format currency correctly", function() {
    var plugin = createObject("component", "myHelper").init();
    var result = plugin.formatCurrency(1234.56);
    expect(result).toInclude("1,234");
});Run tests:
box testbox run6. Publish to ForgeBox
cd plugins/myHelper
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/username/wheels-my-helper.git
git push -u origin main
box login
box publishPlugin Types
Common CFWheels plugin categories:
Data Helpers - String manipulation, date formatting, validation
Authentication - User authentication, session management, encryption
API Tools - REST helpers, JSON formatting, API clients
Database - Query helpers, soft delete, auditing
UI Components - Form helpers, tables, pagination
Email - Email formatting, templates, sending
Caching - Cache management, warming, invalidation
Testing - Test helpers, fixtures, mocking
Best Practices
Naming Convention: Always prefix with
wheels-(automatic)Function Naming: Use clear, descriptive names
Documentation: Document all public functions with Wheels format
Testing: Include comprehensive test coverage
Versioning: Follow semantic versioning (MAJOR.MINOR.PATCH)
Dependencies: Minimize external dependencies
Compatibility: Test with supported Wheels versions
How Plugin Loading Works
Wheels scans
/pluginsdirectory on startupEach plugin's main CFC is instantiated
With
mixin="global", functions become available in:Controllers
Models
Views
Other plugins
Call
wheels reloadto reload plugins after changes
Error Handling
Plugin Already Exists
[ERROR] Plugin already exists
Plugin 'myHelper' already exists in /plugins folderSolution: Choose a different name or remove the existing plugin first.
No Wheels Application
The command must be run from within a Wheels application directory.
Notes
Plugin is created directly in
/pluginsdirectoryPlugin name automatically prefixed with
wheels-if not presentFolder name uses simple plugin name (without
wheels-prefix)Use
mixin="global"to make functions available everywhereRestart or reload Wheels after creating plugin
Plugin functions documented with
[section: Plugins]formatType must be
cfwheels-pluginsfor ForgeBox categorization
See Also
wheels plugin install - Install plugins from ForgeBox
wheels plugin list - List installed plugins
wheels reload - Reload application
Developing Plugins - Full plugin development guide
Last updated
Was this helpful?

