PHP
Article

First Look at Flarum – Next Generation Forums Made Simple

By Jeff Smith

Flarum is a forums solution that is currently in public beta and is under active development. Today we’re going to take a look at it, get it set up in a Homestead Improved Vagrant virtual machine, and look at the configuration and the features that Flarum offers. Then, we’ll compare it to some other forums platforms to see how it stacks up at a glance.

Flarum Logo

Environment Setup

For our environment, we’ll be using a Homestead Improved Vagrant VM. More details about the setup can be found in this quick tip on getting Homestead Improved up and running. If another type of development environment is to be used, we can skip this step, otherwise, please follow the above HI setup guide before continuing.

For the purposes of this article, the folder used is flarum and the application name (and host set up in /etc/hosts) is flarum.app. In our Homestead.yaml, we should have our flarum.app entry pointing to the home/vagrant/Code directory.

Now, after vagrant up we should be able to access our app in our browser via http://flarum.app.

Setting up Flarum

We will be loosely following the Flarum installation guide.

First, on our host machine, we download the latest release of Flarum (this article was written using the 0.1.0-beta.2 release). Then, we unzip the contents to our flarum directory.

Webserver Configuration

Next, we vagrant ssh into our Homestead VM, and edit our nginx configuration file.

sudo nano /etc/nginx/sites-available/flarum.app

We’ll need to add the following lines (they can be added just above the location ~ \.php${} block):

    location /api { try_files $uri $uri/ /api.php?$query_string; }
    location /admin { try_files $uri $uri/ /admin.php?$query_string; }

    location /flarum {
        deny all;
        return 404;
    }

Then, we’ll restart nginx to make sure that our changes are saved before we begin:

sudo service nginx restart

Database Configuration

While still logged into our Vagrant machine, let’s go ahead and set up the Flarum database. When creating the new user, we will choose and set a password for the Flarum application to use to access MySQL.

mysql -u homestead -psecret
  CREATE DATABASE flarum;
  CREATE USER 'flarum'@'localhost' IDENTIFIED BY 'password'; 
  GRANT ALL PRIVILEGES ON flarum.* TO 'flarum'@'localhost';
  FLUSH PRIVILEGES;

We may then exit the MySQL prompt (CTRL+C). Now, on the host computer, we open our browser and enter flarum.app/. We should see the Flarum installation screen.

Flarum Installation

We’ll call our test forum “Flarum”. Enter the MySQL connection information. Our user was flarum and our password was password.

For administrator credentials, we will use forumsadmin, an email, and a password. For the purposes of this demo, we will just use password.

Note: There is a known bug in this process at the time of this writing. If Flarum does not accept the administrator name (if it is invalid), it will fail silently. Usernames must only contain letters, numbers, dashes, and underscores.

If all went well, we will be on the main forum screen. Congratulations – our forum is now functional!

Initial Adjustments

Let’s page through the Flarum administration menu first. We can access the administration menu from the user menu in the top right.

Basics

Flarum Administration - Basics

Under Basics, we can change the banner that currently advises us that Flarum is a beta product, and of course the standard Title, Description, etc.

Permissions

Flarum Administration - Permissions

Under Permissions, we have a few basic moderation tools, such as:

  • Viewing Discussions
  • Signups
  • Replying
  • Post Editing
  • Liking
  • Moderation Actions

These can all be applied to user groups, and new groups can be created, allowing us to have multiple levels of trust among our users.

Appearance

Flarum Administration - Appearance

Under Appearance, we can select the hexadecimal colors we’d like for highlighting and for background elements. We can also toggle on a dark mode or colored header. This is also the place where custom CSS rules can be deployed on top of Flarum’s standard CSS.

Flarum Administration - Custom CSS

Extensions

Flarum Administration - Extensions

The Extensions tab shows us all of the currently installed extensions. We can click the dotted menu icon next to each (when hovering over it) to disable, enable, or uninstall. In the future, we will be able to use the “add extension” button, but for now, we’ll have to manually install extensions by dropping them into our extensions folder, if we find (or create) any third party ones.

Tags

Flarum Administration - Tags

The last menu, Tags, allows us to create tags that can be used on discussions. Flarum employs a two level tag hierarchy – primary and secondary tags. At the moment, it seems as though the creation dialogue only allows the creation of secondary tags. We can drag these up and deposit them as children of a primary tag, or leave them on the secondary tags list to be displayed alongside the primary tag(s) in the Tag list. This is a bit confusing, hopefully to be cleared up later in development.

Themes and Extensions

Theming is a mixed bag with Flarum. There is an easy way to add one-off styles modifications, in the Appearance section of the admin panel. Flarum uses the CSS preprocessor LESS, which was chosen for a variety of reasons by the developers over Sass and other options.

Example Customizations

Here is our flarum.app, with Dark Mode turned on via the Appearance administration tab.

Flarum App Dark Mode

We will do a quick customization to demonstrate how simple it is to make small stylistic changes to the theme.

If we go to the Appearance tab in the administration menu, and click ‘Edit Custom CSS’, we can then enter our own custom CSS or LESS.

Our goal for this simple customization will be to alter the color of the ‘Start a Discussion’ button. We would like to make it red, to make it more eye-catching to the new visitor. So, after we identify the class we want to target as IndexPage-newDiscussion, we can go ahead and just write out a single line of CSS:

.IndexPage-newDiscussion {background:#ff0000;}

And that’s all there is to it. If we take a look at our home page again, we will see our change in place:

Flarum App Dark Mode Altered

Changes can, in theory, be made to any of the styles in the app. Now, of course, we will want to alter more than a few small styles when we are using Flarum in production. One way to do that will be to build our own theme files, within the extensions system.

Extensions

If we have alterations to the structure, functionality, or appearance of the instance to perform beyond what the administration menu or default extensions offer, we can create our own extension. Extensions will be an integral part of Flarum as the community grows, especially given the ease with which they can be created. A skeleton extension can be generated as the first step to create an extension. The theming portion of extensions is explained more fully on the themes documentation page. With regards to themes, Flarum also helpfully provides a list of the LESS variables used in the site in the variables.less file, and they use a BEM naming convention for CSS classes.

General Features

  • Infinite Scrolling – this is similar to Discourse, another modern forums platform. Users seem to have a very polar response to this – we love it, or we hate it. Historically, forums software limits the amount of topics or replies within a topic to a certain amount per “page”, requiring us to load a new page to view more. In Flarum, a viewer of a conversation can just scroll through a conversation, loading more responses as they go, until the end – however long it is.
  • Touch Friendly – this is a feature that makes Flarum really stand out. It’s been touch optimized from the start, with gesture support (swipe right to mark a discussion “read” or left to get more options). The animations aren’t overly bulky and the pages are not noticeably slower to load on mobile, either.
  • URLs – Flarum URL formats are intuitive. The url of the tag ‘General’ will be <app base url>/t/general. The URL of our first discussion called ‘test’ which is tagged as ‘general’ will be <app base url>/d/1-test. Also, a post number is appended to the URL to indicate which post within a discussion is being read.
  • Editor – Flarum employs a “floating editor” which appears as a sort of pop up attached at the bottom of the page. We can navigate freely around Flarum while composing our reply to a discussion, allowing us to look at other discussions as needed to compose our response. This is a feature also found in Discourse, and it’s quite handy. The Flarum editor supports MarkDown, BBCode, and Emoji, and will be extensible to support more.
  • Moderation – The customizable moderation groups and permissions are a definite boon for the platform. Even in beta stages, there is already attention being given to moderation, which any community administrator knows is a critical part of running forums.

Comparison to Other Platforms

Overall, Flarum seems as if at release, it may compare well to modern forums platforms like Discourse. Discourse or NodeBB may well be the only real competitors in the same arena. While other modern forums platforms exist, such as vBulletin 5 or Vanilla, Flarum feels like it stands out in a way countered by few. In some cases, it may boil down to a language preference: Discourse is a Ruby on Rails platform, while NodeBB is a Node.js platform.

Flarum is very mobile friendly, which is a struggle for forums in general, but a critical future-proofing feature. Discourse is getting there, but is still a little clunky on mobile, and NodeBB is also mobile friendly – in fact, it claims to be developed mobile first.

The tag based navigation of Flarum may alienate fans of static categories, but we see this more and more in web applications, and tag based sorting definitely has its advantages. Discourse, conversely, uses both categories and tags, and how the combination works out can depend wildly on the implementation, sometimes very useful, other times just a mess. It may depend on the user base’s preferences whether tag-based sorting is a pro or a con of Flarum.

Resources are another big concern, when comparing platforms, and Flarum wins the contest with most other modern platforms (like Discourse) hands-down. It can run on hosts with lower specifications, and feels snappier. This comes at a cost though, as we are forced to consider that more (relatively) mature platforms such as Discourse may have more stability, and already have large communities to support and extend them. Flarum is not yet even ready for production, so time will tell whether this advantage shrinks or becomes overshadowed.

Conclusions

Whether one chooses Flarum as their forums platform of choice may depend on a variety of things. What language do we prefer? A PHP core makes Flarum an excellent choice for PHP developers and for those working with pre-existing PHP applications. The release roadmap and progress of Flarum may tell us much, as well. We can watch to see the development progress, feedback from users, and features that are added into Flarum. As the extensions system matures, and the theming options, we will be able to gauge how customizable this platform will actually be – and whether or not a strong user base grows behind it, or whether it falters. Either way, it should definitely remain on our radar for future projects!

  • Ikenna Darlington

    Hey! Great post.Little has been said on Flarum so far, Went through their offering sometime ago and it looks like the best forum package in php. I hope a stable version comes out soon.

    Also checked through their website then and found out they didn’t include SSO, I believe it would be important for such functionality to be included.

    • http://jeffreyleesmith.com/ Jeff Smith

      Thank you for your thoughts! I also hope they get a release out soon. It’s great to have a PHP based modem forums platform in the works. I know they’re working on the next beta version now.

      SSO is a planned feature for Flarum, I’d assume we’ll see it in the coming months.

      • http://Post20.com robert_joseph2

        Here is something extremely interesting that is worth to pay attention , a superb opportunity for work for those who want to utilise their free time to make some extra money using their computers… I have been working on this for last two and half years and I am earning 50-80 dollar/ hour … In the past week I have earned 13,245 dollars for almost 20 hours sitting ….

        Any special kind of skills or qualification is not required for this, just normal typing and a reliable internet connection ….

        Time limitations are not here to start work … You may work on this any time when you get some time ….

        Check it out how I’ve been doing this….view WebsiteIink on my` profile` to know how I use to work on this`

        #6y

      • http://Post20.com Deborah Boyer

        This is something very interesting that is worth paying your extreme attention ,a very good chance to work for those people who want to use their free time so that they can make some extra money using their computers… I have been working on this for last two and half years and I am earning 60-90 dollar/ hour … In the past week I have earned 13,70 dollars for almost 20 hours sitting ….

        Any special qualification, degree or skills is not necessary for this, just keyboard typing and a good working and reliable internet connection ….

        Not any Time limitations to start work … You may do this work at any time when you willing to do it ….

        Just know how I have been doing this…..….see this (webiste-Iink) on my !profile!` to know how I am working` on this`
        $%GB

      • http://Post20.com theresa_lee7

        This is something very interesting that is worth paying your extreme attention ,a very good chance to work for those people who want to use their free time so that they can make some extra money using their computers… I have been working on this for last two and half years and I am earning 60-90 dollar/ hour … In the past week I have earned 13,70 dollars for almost 20 hours sitting ….

        Any special qualification, degree or skills is not necessary for this, just keyboard typing and a good working and reliable internet connection ….

        Not any Time limitations to start work … You may do this work at any time when you willing to do it ….

        Just know how I have been doing this…..….see this (webiste-Iink) on my !profile!` to know how I am working` on this`

        *u8

  • PHPDev

    I like this software, but it seems like it’s still in beta. The creator of esotalk is part of the Flarum team, but I want to see the header and footer customization again. Hopefully they will implement this in the new Flarum software. Also, looking at the source code, it looks like they are using part of Symfony as well.

  • PHPDev

    Oops, I meant to say Laravel, not Symfony. I remember it used one of those 2 frameworks. I was looking at the source codes like 3 weeks ago.

  • castbound

    For some time I follow the development of the forum software, as is the old way of discussion is outdated and boring.
    Flarum looks promising, but missing lot’s of (really lot) basic features.
    No private messages (I think it is under construction), uses a very old way of writing (no WYSIWYG, but ugly markup language) which is a huge drawback, very slow develop (if they continue like this for 4-5 years they will finish with basic features that offers most of the forum software).
    On the other hand looks refreshing compared to the old look of other forums, but the lack of basic option is not recommended to install this forum (until it develops).

    Nodebb is also not bad, but very limited (lack of other database support, hard user integration/sessions with external web application), very bugged (only works fine with default installation).For some very basic features nodebb can work, but as soon as you need something more you look for another forum.

    Discourse is very flat forum and I dont like basic design (it’s very basic). It uses Ruby on Rails and Postgres database. No other (eg. MySQL) database support.

    • http://jeffreyleesmith.com/ Jeff Smith

      Thanks for your comments!

      Yeah, it definitely is missing some basic features – however, the same can be said of most software that’s pre-release :) And you’re right, private discussions are in their list of extensions to be built.

      As for the editor – they use Markdown, which I wouldn’t call “old way” – it’s a current writing trend, I do all of my writing in Markdown. And according to the FAQs, they’re planning on implementing a visual editor as well, so that will probably be what you’re looking for.

      That all said, you’re definitely right that things are going slow. At this point, Flarum still isn’t a viable production software, so we’ll have to… wait and see, I guess. I’d definitely agree with you that it’s not a thing to use in production as of yet – and so do the Flarum developers, they’re very clear about that!

    • Vasia Pupkin

      Flarum.

      WYSIWIG? It is easier to _write_ like *this* than mouseclick everywhere just for bold or underline. Everything else is not even needed to exist.

      I am glad they did not turned Flarum into a fugly crappy phpBB or yaBB with horrid BB code. I hope it will stay that way and they will refuse bring this garbage from the last century.

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in PHP, once a week, for free.