9

I understand Craft Templating pretty well, but when it comes to programmation I am entirely lost, I don't get how it works. I used to use CodeIgniter a lot, which is a MVC as you guys may know. In CodeIgniter, everything goes through the controller, then in the controller, I call models. In models, I interact with database and then return the data to the controller and then display a view. In Craft, it doesn't seems to work like this. Is there any good tutorials for "programming" in Craft or develop a plugin? Like how controllers, models, services and events works? Or is there any good people willing to help me?

I want to use Craft so much, I just need to understand it before I use it at large for my client's projects.

I appreciate your help.

Matt Stein
  • 4,006
  • 3
  • 26
  • 57
JeePee
  • 93
  • 1
  • 4
  • This seems to be a duplicate of this question. See if that doesn't help. If you have a more specific question, please ask — we'll be glad to help. Additionally, you might want to check out a plugin called BusinessLogic which provides a nice plugin template for getting started. – Douglas McDonald Dec 16 '14 at 20:35
  • Hi, thanks for your answer. I did some reverse engineering on a plugin to see how things work. It seems that "models" in codeIgniter are "services" in Craft and "models" are used to validate data. I can accomplish what I need to do but it would be great if I could understand the basics. – JeePee Dec 16 '14 at 21:21
  • 1
    Check out the plugin development docs. They provide a pretty good overview of the different components. – Douglas McDonald Dec 16 '14 at 21:42

4 Answers4

10

We just published a video course on Craft plugin development that might help you. https://craftquest.io/courses/how-to-create-craft-plugin

CraftQuest
  • 1,057
  • 9
  • 11
  • 3
    Pay almost 50 bucks for the lack of documentation? That's ridiculous. – Stalinko Feb 16 '18 at 17:38
  • @Stalinko Why shouldn't they charge for their work? Confused. It's not like it's a video made by the developers of Craft – Chuck Le Butt Oct 17 '23 at 16:45
  • @ChuckLeButt if those guys aren't affiliated with Craft then I don't blame them. Rather I blame Craft makers in this case. – Stalinko Oct 18 '23 at 06:24
  • @Stalinko There has been documentation for plugin development dating back to when this question was asked, but it has improved dramatically since then. (It's been almost 10 years, so it better have!) https://craftcms.com/docs/4.x/extend/ – Todd Prouty Dec 08 '23 at 10:13
7

You can have https://pluginfactory.io generate the Craft CMS plugin framework for you.

If you're writing a plugin for Craft CMS 3, this may help you as well: So You Wanna Make a Craft 3 Plugin?

andrew.welch
  • 11,551
  • 22
  • 31
6

You can find the plugin development docs here

There is also the cocktail recipes plugin by Adrian Macneil inspired on the docs

Both will give you a pretty good understanding of how plugins, controllers, models, services, ... work

You can also find lots of free / open source plugins on straightupcraft.

  • I know this answer is a couple years old, so no disrespect... but at this point, the Cocktail Recipes plugin is extremely outdated, and shouldn't be used as a reference point for learning plugin development. – Lindsey D Jun 24 '16 at 22:11
  • @LindseyD Do you know if there is a Craft 3 plugin that would be good to start learning plugin development? I'm feeling pretty overwhelmed right now. – Jim Pannell Aug 24 '18 at 11:53
1

I wrote an article with introductory topics on building a Craft CMS 4 plugin and welcome any feedback.

Exploring GitHub repos for existing Craft plugins is also a great way to learn.

And finally, joining Craft's Discord has excellent discussion and support.

Dario Zadro
  • 173
  • 7