<p>I am Using Craft 3.3.11 version</p>

<p>I have a php file in </p>

<blockquote>
  <p><em>plugin/elementapi/src/services/EapiServices.php</em></p>
</blockquote>

<p>and the same file within </p>

<blockquote>
  <p><em>vendor/craftcms/element-api/src/services/EapiServices.php</em></p>
</blockquote>

<p>When I hit the <em><a href="http://localhost:9001/index.php/api/news.json" rel="nofollow noreferrer">http://localhost:9001/index.php/api/news.json</a></em> 
EapiServices.php from vendor folder is triggered instead of EapiServices.php file from plugin folder. </p>

<p>Can someone help to to make the services files to work within the plugin directory?</p>

CC BY-SA 4.0
2019-11-28T20:53:16.040Z
Have you check your namespacing?
Oli
CC BY-SA 4.0
2019-12-05T05:42:58.893Z
Yes, my namespace is `craft\element\services` and class name is `EapiServices` but still its throwing "Class 'craft\\elementapi\\services\\EapiService' not found"
Velan
<plugin-development><craft3><plugin-elementapi>
ElementAPI: How to trigger the Custom service php file when a endpoint is loaded
# ElementAPI: How to trigger the Custom service php file when a endpoint is loaded

(Asked by: username_0 on 2019-11-28)

I am Using Craft 3.3.11 version

I have a php file in

> *plugin/elementapi/src/services/EapiServices.php*

and the same file within

> *vendor/craftcms/element-api/src/services/EapiServices.php*

When I hit the *<http://localhost:9001/index.php/api/news.json>*
EapiServices.php from vendor folder is triggered instead of EapiServices.php file from plugin folder.

Can someone help to to make the services files to work within the plugin directory?

**Tags:** plugin-development, craft3, plugin-elementapi
> **Comments:**
> **username_1**: Have you check your namespacing?  
> **username_0**: Yes, my namespace is `craft\element\services` and class name is `EapiServices` but still its throwing "Class 'craft\\elementapi\\services\\EapiService' not found"  

---

## 0 answers

