ExpressionEngine 3 has brought a lot of changes and if you’re coming from EE2, you might miss some that are really interesting. Ellislab team has a done a good job of bringing APIs and services for third party developers to use in their add-ons. Your code will be cleaner than ever 🙂

Here is just a selection of things that are used in almost every add-ons, the ones that you should really use in your next project.

Use Models


Messing around with SQL queries might be ok, but if you add-on is quite complex and modify EE data, you might want to switch to using models. Models help you handling EE data (channel, members…) but you can also create your own ones. You’ll just rely on EE code and APIs, it’s way safer and will facilitate maintaining your code.

Plus it totally makes sense to use that service when doing OOP. It’s way easier to get back Objects and play with them, than getting back SQL results and process them before doing anything relevant.

Use shared form view


Creating forms can be long and complex. But with the shared form view, it’s so easy you’ll even enjoy it. You basically need to declare your form using arrays. A lot of different field types are available. EE will generate all the HTML for you. Honestly, dealing with add-on settings is no more a pain now.

Use validation service


Now it’s time to validate the user inputs. Again, no more pain, just use the validation service. It contains pre-defined rules and you can also create custom ones. Easy to write, easy to maintain, and a nice beautiful code. 😀

Add internal documentation


This is not a code tip, but EE now includes internal doc. If you add a file inside your add-on folder, you’ll be able to access that file from within EE. It might not be useful to you, but it’ll surely be for other developers out there that will need your add-on doc. 😉

Check the other services

ExpressionEngine 3 is providing other services that you might want to use, check them out.

EE3 architecture is working with dependencies, prefixes and providers.

There’s even a tree data structure if you ever need one.