<p>Looks like a casing issue to me. You should be calling:</p>

<pre><code>craft()-&gt;campaignReports_campaignMonitor-&gt;getSettings();
</code></pre>

CC BY-SA 3.0
2014-08-07T15:40:17.960Z
No problem! Happy to help :)
Tyler Willingham
CC BY-SA 3.0
2014-08-07T15:32:38.347Z
2014-08-07T15:32:38.347Z
Tyler Willingham
<p>I'm trying to build my first plugin using a service but i can't seem to get it to work.</p>

<p>The file is named CampaignReports_CampaignMonitorService.php and it's in the services folder of my plugin.</p>

<p>This is the code of the service:


<pre><code>class CampaignReports_CampaignMonitorService extends BaseApplicationComponent
{

    public function __construct()
    {        

    }

    public function getSettings()
    {
        return true;
    }
}
</code></pre>

<p>I'm calling the service as follow:</p>

<pre><code>craft()-&gt;campaignReports_CampaignMonitor-&gt;getSettings();
</code></pre>

<p>This causes an internal server error with the following message:</p>

<pre><code>Internal Server Error

Property "Craft\WebApp.campaignReports_CampaignMonitor" is not defined.
</code></pre>

<p>Any idea what i'm doing wrong? Probably some naming convention I haven't followed exactly but I just don't find it</p>

<plugin-development><services>
Service not defined
# Service not defined

(Asked by: username_0 on 2014-08-07)

I'm trying to build my first plugin using a service but i can't seem to get it to work.
The file is named CampaignReports_CampaignMonitorService.php and it's in the services folder of my plugin.
This is the code of the service:


class CampaignReports_CampaignMonitorService extends BaseApplicationComponent
{

    public function __construct()
    {        

    }

    public function getSettings()
    {
        return true;
    }
}

I'm calling the service as follow:
craft()->campaignReports_CampaignMonitor->getSettings();

This causes an internal server error with the following message:
Internal Server Error

Property "Craft\WebApp.campaignReports_CampaignMonitor" is not defined.

Any idea what i'm doing wrong? Probably some naming convention I haven't followed exactly but I just don't find it

**Tags:** plugin-development, services

---

## 1 answers

### Answer by username_1 on 2014-08-07. Score: 5 | Accepted answer

Looks like a casing issue to me. You should be calling:
craft()->campaignReports_campaignMonitor->getSettings();

> **Comments:**
> **username_1**: No problem! Happy to help :)  

---

