In Drupal 8 service is any object managed by the services container. Drupal 8 introduces the concept of services to decouple reusable functionality and makes these services pluggable and replaceable by registering them with a service container. As a developer, it is best practice to access any of the services provided by Drupal via the service container to ensure the decoupled nature of these systems is respected. services are used to perform operations like accessing the database or sending an e-mail. like below: $connection = \ Drupal :: database ( ) ; $result = $connection - > select ( 'node' , 'n' ) - > fields ( 'n' , array ( 'nid' ) ) - > execute ( ) you can create your own services, like create common used function with in the class and use it any where, It works like global functions. To create our own services, just create a services file like modulename.services.yml , services: drupalup_service.co...
Trying to Learn new things on drupal.