Drupal 8 has made lot of improvements from Drupal 7. There are some bigger API changes and have incorporated with many good practices in the website development.
drupal 8
In drupal 8 we can use hasPermission() method to check user permission.
In drupal 8 you can get current logged in users info by using currentUser() method. If you want to use it in module file or other than a class you can call this method like below...
It may feel crazy to build a module without module file in drupal. But in drupal 8 it is possible. Which means module file is not a mandatory entity in drupal. Instead of writing everything inside module file drupal 8 will make your code more structured by using classes and objects.
Today we are going to create a smile module which creates a sample page using custom menu callback.
First let us list down the steps to create this module in drupal 7: