How do I get comment form? In Drupal 7, comment form can be rendered using the following code.

drupal_get_form("comment_node_{$node-&gt;type}_form", (object) array('nid' =&gt; $node-&gt;nid));


How can I achieve the same in Drupal 8?
See https://api.drupal.org/api/drupal/core%21modules%21comment%21src%21CommentLazyBuilders.php/function/CommentLazyBuilders%3A%3ArenderForm/8.2.x.

You create a comment entity and then get its form.

&lt;?php
$values = array(
    'entity_type' =&gt; $commented_entity_type_id,
    'entity_id' =&gt; $commented_entity_id,
    'field_name' =&gt; $field_name,
    'comment_type' =&gt; $comment_type_id,
    'pid' =&gt; NULL,
  );
$comment = \Drupal::entityTypeManager()-&gt;getStorage('comment')-&gt;create($values);
$form = \Drupal::service('entity.form_builder')-&gt;getForm($comment);