I am sharing a custom module which function is to collect a developer data and show list of that data with header sorting and pagination and also used form validation. If Anybody wants to use this module just download the ZIP and put it in custom module folder of drupal 8 and then enable it. it starts working. I am sharing code only of controller class rest user can create or download zip.
Below is the explanation for better understanding:
Create a folder name bd_contact in custom module folder of your drupal project and then create src/Controller.after that create a PHP file name AddForm.php and write the code.