1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Code documentation?

Discussion in 'XenForo Development Discussions' started by TheJoker, Mar 4, 2013.

  1. TheJoker

    TheJoker Member

    Is there any code documentation for XenForo that lists the native classes, their methods, etc.?
  2. wickedstangs

    wickedstangs Well-Known Member

  3. TheJoker

    TheJoker Member

    Anything? There's gotta be a better way than just browsing through the code...
  4. Lawrence

    Lawrence Well-Known Member

    There isn't anything official at this time. When XenForo first came out, I was lost when it came to MVC. Mike advised me to go through the code, and that is what I did. I had a ton of questions and both Mike and Kier where very helpful in answering, or guiding me. Today there is a lot of tutorials available that you may want to read first, both official and unofficial. Finding a specific class is fairly easy, only because of how XF is structured. Each class is well documented within the file.

    For example:

    Loading of data is handled by a model. If you want to look at what is available for users then it's: library/XenForo/Model/User.php
    Controllers handle the action. There are public, admin, response, and helper controllers. Members adjusting their account info (this is public), will be done here: library/XenForo/ControllerPublic/Account.php. Thread controller: library/XenForo/ControllerPublic/Thread.php

    If you take a look at the controller file for Thread (just as an example), you should be able to tell exactly where each model, or view, is located as they follow the XenForo/Xxxxxxx/Xxxxxx structure.

    This basic tutorial should help: http://xenforo.com/community/threads/creating-an-addon.5416/ I wrote it when I was still learning MVC, and made some changes as I learned more.

    I hope this helps in the meantime.
    euantor and Brent W like this.
  5. euantor

    euantor Well-Known Member

    Even a simple PHPDocumenter API type page would be extremely welcome to me. I have a fairly adequate knowledge of PHP, but have never used Zend or any of XF's internal classes.
  6. Chris D

    Chris D XenForo Developer Staff Member

    I have been able to learn PHP from scratch just by looking at the existing XenForo code.

    No documentation required.

    The best documentation is right there.
    SchmitzIT likes this.
  7. euantor

    euantor Well-Known Member

    True, but we don't all have hours of free time. Provided the code is commented correctly, running PHPDocumentor would only take a couple of minutes and would be extremely helpful. Many other projects use it to provide a basic overview of the classes (such as PyrCMS, Laravel, possibly even Zend Framework). Heck, I might just try running it my self so I can have a class reference to refer to and post a link up for people to use.
  8. Chris D

    Chris D XenForo Developer Staff Member

    The code is very well commented.

    I don't have hours of free time either...
  9. euantor

    euantor Well-Known Member

    Fair enough, just had a look at it for a quick five minutes and it seems most of the core has PHPDocuemntor tags where required. I'll generate the docs my self for personal use.
    HWS and Chris D like this.
  10. euantor

    euantor Well-Known Member

    And here we go, full class reference for the latest release of XF. Might as well let others use it if they find it as useful as I will. Got a full Class, Interface and Method reference.

    MattW and tyteen4a03 like this.
  11. MOZ

    MOZ Well-Known Member

    Excellent. Request to mods to Sticky this for future reference.
  12. MOZ

    MOZ Well-Known Member

    Code you provide a downloadable copy as a resource, so developers can install it to their local?
  13. euantor

    euantor Well-Known Member

    Lucas likes this.
  14. RobParker

    RobParker Well-Known Member


    I've been away for a few days but don't think I've missed that much :p
    Crayo likes this.
  15. euantor

    euantor Well-Known Member

    Eh, I might have mistyped. Updated. Thanks for pointing that out ;)
  16. Lucas

    Lucas Well-Known Member

    Awesome stuff right here, much appreciated!
  17. mariohn

    mariohn Member

    Thanks this is very helpful

Share This Page