Laratalks #7 – All about A.I.

Laratalks #7 – All about A.I.

When comes to Artificial Intelligence, PHP programming language would never cross most programmer’s mind.

So happen there is a PHP community called Laravens. They were founded around 6 months ago and organize monthly gathering called Laratalks. Each time they will invite guests from the industry to share cool knowledge among the community.

July Laratalks’ topic was about A.I.. When this event details first pop up in my mailbox, I was so excited and signup straightaway.

If you are a PHP developer, you would agree that it’s quite hard to find resources to develop AI in PHP. Even though it’s technically possible, most people wont recommend using PHP for AI.

So I was here at Co-Labs, a new and very cozy co-working space located in Glenmarie Shah Alam.

After registering at the entrance, first thing to do: enjoy the free foods!

(Photo credit: Laravens)


First session was held by AJ, co-founder of Laravens. His topic was about API.AI, a natural language processing engine, a.k.a tool to develop chat bot.

Technically speaking, chat bot is somewhat beginner level of A.I. but it can very useful in real world application. Just recently, CIMB and Hong Leong both updated their mobile app into chat bot style, though, I feel it’s just a bunch of IF ELSE or Switch cases. Please correct me if you are involved in the new app.

On higher level application, API.AI or chat bot in general can actually do things like task automation, control smart home devices, hotel booking and etc. 1 new thing I discovered from the speech was that API.AI now let you import ready made natural language library like FAQ, Hotel Booking and many many more. With just a click, you no longer have to start your natural language processing engine from scratch. After building your language model, toggle the integration channel (facebook, slack, twitter….etc) and you are ready to roll out your chat bot.

Best things of all, it’s free! (depends on Google Cloud Platform quota)

General concept about AI

Second session was a general overview about AI, by Dr Lau Cher Han. Nothing new here, we could easily learn about it from the internet.

Travelling salesmen problem

In layman term, when salesman (or any moving object) is given with a list of places to visit, it has to depart and return to the starting point in the end. So we need algorithm to calculate the most efficient and/or shortest path for this moving object.

The trickier part is when there are multiple salesmen (moving objects) + multiple locations, how do we split the salesmen into multiple routes in most optimal way?

Last year, we were being enquired to build similar solution for their company. Back then, we figured a way to do this and then planned to write the algorithm from scratch.

So in the last session which was spoken by Zulfa, he demonstrated how they solve their TSP. And it’s fairly simple by utilising machine learning.

Zulfa showed us a machine learning library for PHP called PHP-ML. First, they dump all their location coordinates’ into PHP-ML’s k-mean algorithm, and it will return with multiple clusters of coordinate in array form, which has been optimized for route efficiency.

Now the coordinate arrays are efficient enough, it is time to route it out on the real world map. So next step is to send all the arrays into OSRM (Open Source Routing Machine), then it will overlay the routes onto OpenStreetMap.

The demo ended here, but this solution doesn’t has the ability to factor in the real time traffic condition, because OpenStreetMap doesn’t has traffic data.


This gathering has benefited me a lot, hope the next one will be even more interesting. Good job Laravens!