Answers.Body: <p>The Similar plugin allows access to its <code>find()</code> method from PHP and your Element API configuration file.</p>
  
  <pre><code>$similarEntriesByTags = craft()-&gt;similar-&gt;find([
      element =&gt; $entry,
      context =&gt; $entry-&gt;tags,
      criteria =&gt; $limitCriteria,
  ]);
  </code></pre>
  
  <p>This is the equivalent to the Twig example code in the readme.</p>
  
  <pre><code>{% set similarEntriesByTags = craft.similar.find({ element: entry, context: entry.tags }) %}
  </code></pre>
  
  <p>If you’re inexperienced in quering for entries or using element criteria in PHP in general have a look a the <a href="https://craftcms.com/docs/plugins/working-with-elements" rel="nofollow">Working with Elements</a> article in the Craft documentation.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-30T16:06:03.723Z
Answers.LastActivityDate: 2016-09-30T18:09:35.243Z
Answers.LastEditDate: 2016-09-30T18:09:35.243Z
Answers.UserDisplayName: carlcs
Body: <p>How can I pull out other entries related by tag using the Element API?</p>
  
  <p>In this particular case I'm using the <a href="https://github.com/aelvan/Similar-Craft" rel="nofollow">Similar</a> plugin to pull out related entries by tag in the templates. I'm not sure if this would help to provide an easier way or not...?</p>
  
Tags: <tags><plugin-elementapi>
Title: Element API: List entries related by tag
ThreadText: # Element API: List entries related by tag
  
  (Asked by: username_0 on 2016-09-30)
  
  How can I pull out other entries related by tag using the Element API?
  
  In this particular case I'm using the [Similar](https://github.com/aelvan/Similar-Craft) plugin to pull out related entries by tag in the templates. I'm not sure if this would help to provide an easier way or not...?
  
  **Tags:** tags, plugin-elementapi
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-09-30. Score: 1 | Accepted answer
  
  The Similar plugin allows access to its `find()` method from PHP and your Element API configuration file.
  
  ```
  $similarEntriesByTags = craft()->similar->find([
      element => $entry,
      context => $entry->tags,
      criteria => $limitCriteria,
  ]);
  
  ```
  
  This is the equivalent to the Twig example code in the readme.
  
  ```
  {% set similarEntriesByTags = craft.similar.find({ element: entry, context: entry.tags }) %}
  
  ```
  
  If you’re inexperienced in quering for entries or using element criteria in PHP in general have a look a the [Working with Elements](https://craftcms.com/docs/plugins/working-with-elements) article in the Craft documentation.
  
  
  ---
  
  