How do I get started?

John L.

Well-known member
Hi Guys,

I'm interested in trying to learn how to make XenForo 2 add-ons. I have minor experience with PHP, just enough to adjust some code...but not enough to entirely understand what I'm doing. What would be some of the best ways for me to get started learning how to code with PHP. I imagine I'll have to learn the basics of PHP and MySQL, but then what? What kind of applications (IDE) should I be using to get started in learning how to code (PHPStorm)?

My web development experience right now is centered more around design and general web construction. HTML, CSS, LESS/SCSS, jQuery and JavaScript. I'm taking to learning JavaScript frameworks, but that's a WIP at the moment.

Just wanted to get an idea of how you all became more advanced coders. Thank you!
 
John, have you poked around https://xenforo.com/xf2-docs/dev/ yet?

Some good info' in there; for the point you're at I'd suggest starting with the "General concepts" section and then following the "Let's build an add-on" section in your test XF environment.
I haven't fully gone through them. I'll try to give them a quick setup and try.

Was curious if there are some potential tutorials for learning how to code PHP properly or if I should just dive into XF and go wild?
 
Do you guys use anything other than Navicat for editing MySQL databases locally? I just got my local environment setup...that was an ordeal. Had no idea that CPU Virtualization wasn't enabled in my BIOS. 2 hours of my life, lost. Haha!
 
Do you guys use anything other than Navicat for editing MySQL databases locally? I just got my local environment setup...that was an ordeal. Had no idea that CPU Virtualization wasn't enabled in my BIOS. 2 hours of my life, lost. Haha!
For editing MySQL databases, i have used Sequel Pro, free version :D
 
Yea, I use that personally, but it seems most editors are better (at least that's what people say haha).
I use the Pmahome theme that makes it a little pleasing to the eyes but for my usage, can't find any major difference.
 
I use the Pmahome theme that makes it a little pleasing to the eyes but for my usage, can't find any major difference.
Nice, I am giving HeidiSQL a try and seeing how it goes. Some people love it and some people say it's fairly buggy and crashes. I'll soon find out!
 
Just wanted to get an idea of how you all became more advanced coders.
  1. Don't set out to learn how to code, set out to create an end result. Learning how to code will be a by-product of learning how to create what you want to create.

  2. Always be prepared to go back and revise your code when you figure out new or better ways of doing what you did previously. Your code is never done, until you have a mastery of your chosen platform (e.g. XF2) where you're confident you will never pick up a new trick.

    Not doing this is how you end up with mods using direct cURL calls instead of using XF2's HTTP Client library, etc. Don't be content because your code works, be content when you're sure it (as close as you can get) 100% follows the standards set out on the platform you're developing on.

    (I am very guilty of violating this myself, partially because most of our XF1/XF2 addons are multi-platform and partially because they contain legacy code. For new XF2-only projects going forward, this point still applies, and I've applied this point extensively in the development of eCommerce.)

  3. If you don't know how to do something, look at how XF2 does what you want to do. If there's no direct equivalent, find indirect equivalents. 99% of the time, you can boil your feature down to something that XF2 does. e.g. "I need to get JSON data from a remote server's API" -> "I need to send a HTTP request to a remote server" = something XF2 does somewhere in its code.

  4. For the love of Odin, get an IDE, or at least an editor with the capability to "search in folder". Starting 50 threads in this forum asking how to do something an IDE could tell you in 30 seconds via some general keyword searches is a waste of your time.

  5. Not directly related to learning how to code, but if you do end up heavily dipping into this forum for assistance, make sure you share the resolution to the problem in the thread. This is especially true if you goofed rule #4 and posted something an IDE told you 30 seconds later. If it's something entirely new, like Tabbed Options, post a development tutorial in the relevant resource category.

  6. Help others with their problems in this forum, even if you don't know the answer yourself. If you think you can figure it out, give it a try. You might end up needing the same solution yourself some day, and if nothing else, frequent posters in this forum will see you helping out and will be more inclined to answer your threads.

That's all I can think of off the top of my head, hopefully that helps :)


Fillip
 
  1. Don't set out to learn how to code, set out to create an end result. Learning how to code will be a by-product of learning how to create what you want to create.

  2. Always be prepared to go back and revise your code when you figure out new or better ways of doing what you did previously. Your code is never done, until you have a mastery of your chosen platform (e.g. XF2) where you're confident you will never pick up a new trick.

    Not doing this is how you end up with mods using direct cURL calls instead of using XF2's HTTP Client library, etc. Don't be content because your code works, be content when you're sure it (as close as you can get) 100% follows the standards set out on the platform you're developing on.

    (I am very guilty of violating this myself, partially because most of our XF1/XF2 addons are multi-platform and partially because they contain legacy code. For new XF2-only projects going forward, this point still applies, and I've applied this point extensively in the development of eCommerce.)

  3. If you don't know how to do something, look at how XF2 does what you want to do. If there's no direct equivalent, find indirect equivalents. 99% of the time, you can boil your feature down to something that XF2 does. e.g. "I need to get JSON data from a remote server's API" -> "I need to send a HTTP request to a remote server" = something XF2 does somewhere in its code.

  4. For the love of Odin, get an IDE, or at least an editor with the capability to "search in folder". Starting 50 threads in this forum asking how to do something an IDE could tell you in 30 seconds via some general keyword searches is a waste of your time.

  5. Not directly related to learning how to code, but if you do end up heavily dipping into this forum for assistance, make sure you share the resolution to the problem in the thread. This is especially true if you goofed rule #4 and posted something an IDE told you 30 seconds later. If it's something entirely new, like Tabbed Options, post a development tutorial in the relevant resource category.

  6. Help others with their problems in this forum, even if you don't know the answer yourself. If you think you can figure it out, give it a try. You might end up needing the same solution yourself some day, and if nothing else, frequent posters in this forum will see you helping out and will be more inclined to answer your threads.

That's all I can think of off the top of my head, hopefully that helps :)


Fillip
Thanks Fillip! That was a good read and yes I'm using PHPStorm (evaluating it) to start. I've never used an IDE so it'll be a learning curve, but I'm hoping it'll help me get a better handle.

I have an addon I want to try to create. It seems simple enough in how I've broken it down:
  1. Define external database that houses data I need
  2. Pull in data from database if forum users matches specific criteria
  3. Display said data in postbit/message template
  4. Display said data in user profile
  5. Set cron to update data every X hours to avoid performance issues
This is at least how I've broken it down. If you see some issues with my logic, let me know!
 
I've read through the developer documentation and I was trying to follow along with the "Let's build an addon" section, but it's so different from what I want to make.

How do I go about finding out how to do the following, how do you even know where to look?
  • How do I define an external database and where should I do that?
  • How do I pull information from that database and place it into the XF database?
These are the first two things that have popped up for me. Should I just start opening new threads asking how to go about this? Or is there a better way to search through XF to find the solution?
 
Hello all! :)

Afters years of development with vBulletin 3 and 4, I'm switched to learn development with Xenforo 2, too :)
wow, I see some known people here. :)

Well, I'm familiar with PHP and HTML/CSS, JavaScript (+ jQuery). So, I'm try to learn the new XF2's "buttons" as developer.

I need too some advices for start learning. About the php/ mysql side, I have read the XenForo 2 Developer Documentation and started watching the integrated to the platform, php files (classes, function etc).

I need more info, like template syntax (example: conditionals / basic CSS classes/ more info about the integrated javascript framework) etc.

Is there any other resources too, other than the XenForo 2 Developer Documentation? :)
 
Hello all! :)

Afters years of development with vBulletin 3 and 4, I'm switched to learn development with Xenforo 2, too :)
wow, I see some known people here. :)

Well, I'm familiar with PHP and HTML/CSS, JavaScript (+ jQuery). So, I'm try to learn the new XF2's "buttons" as developer.

I need too some advices for start learning. About the php/ mysql side, I have read the XenForo 2 Developer Documentation and started watching the integrated to the platform, php files (classes, function etc).

I need more info, like template syntax (example: conditionals / basic CSS classes/ more info about the integrated javascript framework) etc.

Is there any other resources too, other than the XenForo 2 Developer Documentation? :)
Unfortunately, not so much Scandal. I tried searching for more tutorials to help me better understand how to properly setup an addon. While the XenForo Dev document does help with the initial dev environment setup. The documentation is probably good for experienced developers, but not so much for someone who is new to this or is getting their feet wet with XenForo.

I tried searching for some tutorials online, but there is not much. If you find anything, feel free to share :)
 
How do I go about finding out how to do the following, how do you even know where to look?
  • How do I define an external database and where should I do that?
  • How do I pull information from that database and place it into the XF database?
These are the first two things that have popped up for me. Should I just start opening new threads asking how to go about this? Or is there a better way to search through XF to find the solution?
That sounds "too much" for a beginner.

I would start learning the concepts of OOP (with PHP). There are many screencasts and tutorials out there. I like this one (just the first episode about classes is free): https://laracasts.com/series/object-oriented-bootcamp-in-php

In the next step build the addon from the XF2 dev docs and try to understand what's happening. Look at core classes and methods. And then maybe build an easier addon by yourself.
 
Top Bottom