@shyann
In Drupal 8, you can create a node programmatically by using the following steps:
1 2 |
use Drupal
odeEntityNode;
|
1 2 3 4 5 |
$node = Node::create([ 'type' => 'article', 'title' => 'My title', 'body' => 'My body', ]); |
1
|
$node->save(); |
That's it! You have now created a new node programmatically in Drupal 8.