Is it better to create a taxonomy term using the 'create' method of the base Entity class or the entity storage manager? I've seen multiple ways to programmatically create entities. 

In this case I'm creating a taxonomy term. One is using this method

$term = \Drupal\taxonomy\Entity\Term::create([
  'name' =&gt; $name, 
  'vid' =&gt; $vocabulary,
])-&gt;save();


Where I'm using the base entity class's public static create function. Another way to perform the action is using an entity storage manager. Like so:

$term = [
  'name'     =&gt; $name,
  'vid'      =&gt; $vocabulary,
];

$term = \Drupal::entityTypeManager()-&gt;getStorage('taxonomy_term')-&gt;create($term);


I looked up the 'create' function of the base Entity class and it seems to just be implementing what appears in the second example I provided. Is there a better practice between the two? Or does it not matter?

UPDATE: Also is there a difference between what the two return? Unless I'm doing things wrong I noticed that the top method returned an int which I'm assuming is the term id.
In procedural code it doesn't matter, because both do the same. The static create() is a shortcut for the second example. (The different result is because the first saves the term and the second does not, if you want the term as result then save in a separate step)

In OOP code a better way is dependency injection. The second example points in the right direction. Inject the entity type manager, store it in a class property and use it:

$term = $this-&gt;entityTypeManager-&gt;getStorage('taxonomy_term')-&gt;create($term);


How to inject a service depends on which class you want to use it in.

A lot of base classes include services already and if you are lucky such a common service like this is one of them. Sometimes, for example in a controller, there is a method to retrieve the service. Then add to the code above parentheses: 

$term = $this-&gt;entityTypeManager()-&gt;getStorage('taxonomy_term')-&gt;create($term);


See ControllerBase::entityTypeManager().