Category Archives

2 Articles

Reviews

REVIEWS: Botman – PHP library to build chat bots

Posted on
REVIEWS: Botman – PHP library to build chat bots

The proliferation of messenger apps has fueled the development of chatbots. With the incredible amount of platforms and tools now available, it is becoming a lot easier to build chatbots. If you’d like to build your own, Marcel Pociot’s Botman PHP library makes it faster to create a bot that works across multiple messaging platforms likes Slack, Telegram, Microsoft Bot Framework, Nexmo, HipChat, Facebook Messenger and WeChat.

Facebook Generic Template Screenshot

 

Yes, its that good! It really impressed me and I’ll show you why.

  • First, Botman is Open source – which makes it interesting since there’s a great chance of it being improved over time, and it is easy to integrate in either a pure PHP project or in projects based on Code Igniter or Laravel.
  • Flexibility and control – You can either build your own driver to connect BotMan with other messengers or to use it as an API. You decide which works for you.
  • Support for NLP – Yes, this is the best part! Botman support the use of NLP platforms like Wit.ai or Api.ai which are available through middlewares. This makes it easier for you to understand the user’s message and provide information about their intent. You can of course create your own middleware, isn’t it amazing?

Facebook Button Template Screenshot

 

Installation

Here is the documentation page to guide you to successfully install and customize Botman to soothe your needs. You can also see the Github repo here.

Conclusion

In conclusion, if you want to quickly get to building your chatbots using PHP, Botsman is the perfect choice to get one up and running.

Blog/Reviews

Restricted; A package that restricts usage of protected username

Posted on
Restricted; A package that restricts usage of protected username

Most of the time people want a username which is personal, and means something to them.

As developer, an admin or manager of any website, you would agree that sometimes, it’s important to be able to reserve certain names that you consider official. A good use case here is Twitter. No account names can contain Twitter or Admin unless they are official Twitter accounts.

Imagine you’re building an application that requires a dedicated URL like myapp.com/tailor, but then, a user signups with a username ‘tailor’. This would result in conflict as the system could malfunction trying to determine which URL request to respond to. It becomes even more complicated when a user signs up on your application using words such as; Admin, User, Reset, etc as their usernames while creating a profile on your application.

Why don’t we secure these important words by preventing it users from being able to use them in the first place? In response to this, we created a package – Laravel Restricted which tells the application to index all the application’s route segments and restrict users from choosing them as a username.

How to setup

Install via composer
composer require codulab/restricted

Add the following service provider to the array in: config/app.php

Codulab\Restricted\RestrictedServiceProvider::class,

Publish the config

php artisan vendor:publish --tag=restricted_config

Now, you can simply add ‘restricted’ to your validations in the controller like so:

$this->validate($request, [
'name' => 'required|string|min:5',
'username' => 'required|restricted' // You’re restricting the username field.
]);

You can also add a new validation message:

To view all the words you have ‘Restricted’, navigate to ‘public/restricted-usernames.txt’ file.

You should see this:

Now when you try to use one of the ‘Restricted’ usernames, you should see something similar to this:

    As far as your application requires a registration process, this package is a simple security measure to protect your website.

If you like Laravel Restricted, please STAR it, SHARE it with your friends, USE it and CONTRIBUTE to it.