• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

What Developer Hints are given in XenForo 2.0 Alpha

This entry is part of a series of entries "On the Road to XenForo 2.0"
alpha.jpg


XenForo 2.0 is being completely rewritten. It's a huge project and will have an impact on addon development. The XF Development Team will release a developer version and allow addon developers the opportunity to learn how the 2.0 will influence addon development.

On the 2.0 alpha demo site, Chris, Mike, and many others on the XenForo development team are providing hints about changes to coding in XenForo 2.0. Please add any that I've missed in the comments below.

I. PHP Requirements
The PHP requirements of XenForo 2.0 will definitely be increasing, primarily because we want to take advantage of technologies that newer versions of PHP now offer. The current target is a minimum of PHP 5.4.

II. Services

III. Data Access
  • The base unit for working with data is no longer a bare array. It is now an object that represents the specific type, giving you access to call methods on that object or access other data related to it trivially (getting the forum from a thread from a post).
  • While you can still write SQL directly, most data access is done through a builder object. The builder can control what related data is fetched, what conditions are applied (including against related data) and the order of the results. This can be done in any order.
PHP:
$finder = $this->em()->finder('XF:Post')
    ->where('thread_id', 123)
    ->with('Thread')
    ->onPage(2)
    ->orderByDate();
$post = $finder->fetchOne();
$thread = $post->Thread; // this was fetched with the query
$forum = $thread->Forum; // this is silently fetched as needed
if ($forum->canView()) { /* ... */ }
if ($forum->isUnread()) { /* ... */ }

IV. Namespaces
You don't have to use use statements, but it certainly is useful to alias classes in that way.

V. Addon conventions

VI. Widgetized system
The team will discuss later

VII. Custom thread fields

VIII. Developer documentation

IX. External Accounts Framework and here.
We also support Microsoft, GitHub and LinkedIn now with a library behind it that can provide access to more services, and a framework that can add custom ones.

X. Miscellaneous
And directly from Mike, we learn tons of information on the backend.

New system for "required" parameters in route matching.

Easier methods for skipping ignored content in thread/post queries ($finder->skipIgnored()).

New system for handling common error types (no permission, not found, etc) through a controller plugin. This resolves issues where the online location of a user would be incorrect while also allowing add-ons to extend or change the behavior of these pages more easily.

We will end with Mike's note from August (emphasis added):

The next step would be what could be considered an alpha or a developer preview. This will be the first time that customers will be able to try out XenForo 2.0 on their own server and work with the code/templates. We do not intend on limiting this to selected developers. However, you will not be able to upgrade into this version and you are unlikely to be able to upgrade out of it. You will likely also have to do installation using the command line and taking some manual steps. This preview is specifically designed to start getting initial feedback from developers (and stylers) and keen enthusiasts.

Series table of contents

Blog entry information

Author
LPH
Views
2,196
Last update

More entries in Technology

More entries from LPH

Top