You're probably heard of StackOverflow before, the biggest Question and Answer website. It’s one of the most popular website among developers. But this is not a review of StackOverflow. Instead it’s a review of the Phanbook. A free open source Q&A platform for you to build a website look-a-like StackOverflow.
Why do I need Phanbook while there are tons of PHP Q&A platform out there ?
Yes, you may come up with this question. Phanbook is only in beta version in September 2015 with its first version 1.0.0 while outside, there are plenty of similar platform: Question2Answer, LampCMS, OSQA, Shapado, Askbot...
Well, please read the review and you will understand why Phanbook is your best choice.
Firstly, Phanbook is super super fast. It’s built based on Phalcon PHP framework - the fastest PHP framework nowadays. You can see in the benchmark about Phalcon framework below:
Phalcon is even faster than Slim - the micro php framework for Restful API.
A little bit information about Phalcon Phalcon is an open source, full stack framework for PHP written as a C-extension. When running, the whole framework already is in RAM, so the whole set of files do not need to process.
One more thing that makes Phanbook completely outplay other competitions in performance is ElasticSearch. By using ElasticSearch to index the database, optimised search queries so it reduces the query time and get faster performance.
A Rough Start
Once you have the system installed, you will be able to connect with Phanbook interface, let take look the images below:
I have installed the development version so by default Phanbook gave me some dummy data to testing. The interface’s quite simple but enough for a Q&A website, and easy to start new discussion with the support from CKEditor(you need enable to see it)
Phanbook also was designed for approaching the high resolution touch device, with a built in mobile layout. Read or post from your laptop, tablet, and phone without constantly being told this site has an app.
Like StackOverflow, Badges are used to reward users for their contributions, collaboration and participation in the Phanbook. Badges enable the community to collectively identify the best contributors. And it appears on your profile page, flair, and your posts.
To enable this feature, go to your root phanbook directory and run the follwing command:
php cli Badges
To see all task via command line, you can take look the source on github
Karma or reputation is a scoring system that scoring users for their contributions, collaboration and participation like Badges . Instead of giving the Badges, Phanbook awards points for almost any activity undertaken. By observing the Karma, community also can identify the best as well as the worst contributors.
To see rule calculated reputation you can see the code here for now.
Unfortunately, the Admin dashboard overview is still in development. Thien - the founder of Phanbook said that he wants to listen from users, then he can make the dashboard based on what users want. If you love Phanbook or have any ideas, please do the survey here so he can make your “dream” comes true. Go to at https://github.com/phanbook/phanbook/issues.
Currently, the dashboard only shows some basic information about your website like Pageviews, Visits, Time on Page and Bounce Rate... These information is getting directly from Google Analytics, so you don't need to log in GA for track your website
Looking at the left sidebar, you can see all the features that provided by Phanbook. Let’s take a look at the Post first:
This is just the basic article-management where you can edit, delete or stick the article on top of homepage. There are some advance features that you can use to customise your website in the Settings tabs like change logo, title, tagline or Change theme, adding Google analytics code.
Furthermore, in the template tab, you can directly change the code of sidebar module, register form or forgot password box.
How about the scalable?
Of course, we are not only the end user but also the developers. We think about the scalable, how can we customise Phanbook as most as we can?
How can Phanbook adopts a big system ?
First, let take a look at Phanbook’s structure:
Phanbook is written on Phalcon framework with the latest technologies like Docker, Elastic search and follow strictly to coding standard PSR-4.
If you are a PHP developer, I am pretty sure that you know all about this and can easy to dig inside and changing the code as you want. And if you are just the PHP beginner, you also can work with Phanbook by changing the template inside which is separated with the whole back-end system.
By default, Phanbook provides for us three different kind of template for different purposes.
'theme' => 'default',
Like Wordpress, the themes is well-written in the elegant structure for developers can understand and create new one by themeself easily. Let’s take a look at the default “default” template.
Phanbook uses .volt file to compile the template. Volt is a template engine written in C for PHP which provided by Phalcon. There is nothing new in here, basically inside the .volt file is html tag which you can understand clearly together with some PHP script tag. See the list of all support template functions in here.
Let's take a look at some important files
- post.volt contains all list item from value posts
- single.volt is used to render a single post
- page.volt for rendering static page
You can checkout the documents on Github.
Trust System: As members become trusted regulars over time, they earn abilities to help maintain their community.
Badges: Encourage positive community behaviors through the included set of badges, or add your own custom badges.
Email Notifications: When you aren't active on the website, your notifications will be automatically sent to you via email.
Mobile and Tablet: Designed for touch devices from day one. Automatic mobile and touch layouts that scale to fit your device.
Searching: Powerful search with Elasticsearch.
- Posts: Topic/Tags subscriptions and digest emails, flagging/reporting and an intelligent auto-moderation system
How to install Phanbook ?
Phanbook supports variable of technique, from the hot trend technique like Docker to the manual way.
Let me show you it is easy install Phanbook, for example for Docker:
First, you must to download Phanbook into the current directory:
cd /var/www && git clone https://github.com/phanbook/phanbook
It will create a directory called Phanbook. If you wish, you can rename it to the name of your project.
Build the project
To build an image from a source repository, create a description file called Dockerfile at the root of your repository. This file will describe the steps to assemble the image.
Then call Docker build with the path of your source repository as the argument. But for the package above, we already make a script file for you call phanbook.sh. Simply run the command to execute the Docker build
The default password of mysql is
password__phanbook if you want to change password to mysql just to open opsfile/docker/config.env file then edit the password
Finish up by visiting your app page (make sure you replace the example ip address with your correct one): http://your-ip-docker. It should look similar to the some images above.
Note that: Keep in mind that you don't need to worry about wrong username or password, all the config are stored in core/config/config.php file.
If you want to play the Phanbook with Vagrant, just do following the command below:
chmod +x phanbook && ./phanbook up #or cd opsfiles && vagrant up
Help Phanbook to fly higher
Show your appreciation and help us with project costs by simply donating via Gratipay
Whether one chooses Phanbook as their Q&A platform of choice may depend on a variety of things. What language do we prefer? A PHP core makes Phanbook an excellent choice for PHP developers and for those working with pre-existing PHP applications.
Leave your feedback in the comments below and, as always, please share this article if you liked it!