5

I am attempting to lean how to write a plugin but am having trouble knowing how to work with the Class Reference documentation. I understand all of the theory and how object oriented programs work. But I have never actually worked on a real world problem. I have only worked on small programs to learn the concepts.

I am overwhelmed by the Class Reference and don't know best practices for attacking a new project and using the Class Reference documentation. I feel overwhelmed and stuck, and so my question is can an experienced developer or two share some guidance as to their methodology for working with a framework in the real world?

The plugin itself is conceptually simple. I'm working on developing a application similar to tinyurl.com. I need to store data in a database table and then read it back. I also then need to then figure out how to do a redirect.

My main goal is to get the general guidance on how to approach any new project with regard to how to start. Any guidance on the specific problem is also appreciated.

1 Answer 1

3

You may already be aware of this, but the Class Reference is a complete breakdown of the Craft core. Everything that exists within the craft/app folder is documented here.

Craft is built upon the Yii framework. If you dig deep enough, many roads lead back to Yii queries. Fortunately, you'll rarely have to dig that deep! Craft has abstracted away much of the raw Yii commands into all of its Base classes.

Continuing from there, pretty much everything else that happens in Craft is layered upon the Base classes. You'll notice that most of the common components (Services, Controllers, Records, etc) contain a Base class, and all other classes are extended from there. In general, you can think of the Craft core as being "one big plugin"... In fact, when Craft 3 is released, this will be even more true.

It's important to note that your plugin won't need all of these components. Many plugins require only a few of these components to meet their needs. In your case, you may only need a Service, a Controller, a Record, a Model, and a Variable.


Beyond that, I'll skip any recommendations for your specific plugin project. My intention was only to respond to the general purpose of your question... I'd highly recommend opening a separate question with specific points about what you are setting out to accomplish.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.