Choose a name that’s easy to remember
Plugin names should be 1 word or an abbreviation
Choosing a Name
Anatomy of Plugin
FIG. 1
Slide 4
Slide 4 text
NameSpacesMatter
Anatomy of Plugin
FIG. 2
Plugin folders and urls
File names and classes
Always lowercase
Always CamelCase
Slide 5
Slide 5 text
Primary Plugin Class
Anatomy of Plugin
FIG. 3
Public facing info
Plugin controls
Name, Version, Developer, Developer URL
Settings, hasCpSection, init, onAfterInstall, onBeforeInstall, on->Event
Slide 6
Slide 6 text
Craft vs. MVC
Anatomy of Plugin
FIG. 4
Traditional MVC
Craft Plugin MVC (VVSCMR)
View -> Controller -> Model
View -> Variable -> Service -> Controller -> Model -> Record
Slide 7
Slide 7 text
Creating a plugin variable
Anatomy of Plugin
FIG. 5
{{ craft.lemmings.widget("hello") }}
Template Variable
lemmings->widget($lemmingName);
}
}
index.html lemmings/variables/LemmingsVariable.php
lemmings->widget($lemmingName);
}
}
Service
lemmings/services/LemmingsService.php
>
>
Slide 8
Slide 8 text
Creating a plugin action
Anatomy of Plugin
FIG. 6
I am a form
Template Controller
redirect('/thanks');
}
index.html lemmings/controller/LemmingsController.php
>
Slide 9
Slide 9 text
Introducing Casper
Anatomy of Plugin
FIG. 7
A barebones plugin
Public facing info + admin templates + js/css resources
Find Casper at https://craftpl.us/plugins or https://github.com/CraftPlus/Casper
FREE
Slide 10
Slide 10 text
A peak a Casper
Anatomy of Plugin
FIG. 8
Slide 11
Slide 11 text
Introducing Lemmings
Anatomy of Plugin
FIG. 9
A fully featured plugin
CRUD functionality + embedded variable & asset access + plugin MIT license
Find Lemmings at https://craftpl.us/plugins/lemmings
Slide 12
Slide 12 text
A peak a Lemmings
Anatomy of Plugin
FIG. 10
Slide 13
Slide 13 text
A beating heart
Part 2
(To Sell Plugins)
Slide 14
Slide 14 text
Launching Craft Plus
A beating heart
FIG. 1 - http://craftpl.us
Slide 15
Slide 15 text
Craft Plus Plugins - Part 1
A beating heart
FIG. 2
Slide 16
Slide 16 text
Craft Plus Plugins - Part 2
A beating heart
FIG. 3
Slide 17
Slide 17 text
Craft Plus Plugins - Part 3
A beating heart
FIG. 4
Slide 18
Slide 18 text
Catch and Release
A beating heart
FIG. 5
> Plus Plugin
Stripe Charge
Email Admins
Email Buyer w/plugin
> Plus Plugin +
Record Purchase
Generate Serial
Dashboard, charts and stats
Buy Form
stripe.js
Plugin price, id