The slug is used to construct friendly url, slug is easy to write, easy to understand and descriptive.
The slug is a portion of the URL that corresponds to a specific resource, is usually generated in a text string (usually the title of the page).
The slug has the characteristic to be formed by words divided by a separator, usually the dash (-).
The slug creation systems do some simple steps:
For example, the text i"How Are You?'m Fine, thanks!" becomes "how-are-you-i-m-fine-thanks".
A url with slug will then be much easier to interpret by a web surfer to click on that link.
Here are two url in comparison, the first without the use of slug, the second with the use of a slug:
http://example.com/index.php?page=125
http://example.com/contact-us
contact-us is the slug, easy to remember, easy to see what page we are going to access.
Sites that use slug are also taken into account by the search engines which is better able to categorize the pages.
Pages with slug are therefore much more seo friendly.
Modern frameworks or cms like Wordpress or Symfony using the integrated systems of generation of the slug, usually starting from the headline or the name of the page