<p>It sounds like you're attempting to access the <code>getDeveloper</code> method on your plugin's main <a href="https://craftcms.com/docs/plugins/services" rel="nofollow noreferrer">service class</a>, but the class doesn't exist.</p>

<p>You have two options:</p>

<ol>
<li>Create the service class, and implement a <code>getDeveloper</code> method.</li>
<li>Call the <code>getDeveloper</code> method on your main plugin class (which I suspect is what you're really trying to do).</li>
</ol>

<h2>Option One: Service</h2>

<p>Your minimal service class will look like this:</p>

<pre><code>&lt;?php

namespace Craft;

class CrmPortalService extends BaseApplicationComponent
{
    /**
     * Returns the developer name.
     *
     * You could either hard-code the developer name, or you could
     * retrieve it from the main plugin class, as described in
     * option two.
     *
     * @return string
     */
    public function getDeveloper()
    {
        return 'John Doe';
    }
}
</code></pre>

<h2>Option Two: Plugin</h2>

<p>Craft uses Services to expose functionality, in exactly the same way that plugins do. If you're trying to figure out how to do something, just look for a Craft Service with a similar name.</p>

<p>In this case, you want to retrieve your main plugin file, so <a href="https://craftcms.com/classreference/services/PluginsService" rel="nofollow noreferrer">the <code>PluginsService</code></a> is a good place to start. We're in luck, it has <a href="https://craftcms.com/classreference/services/PluginsService#getPlugin-detail" rel="nofollow noreferrer">a <code>getPlugin</code> method</a>, which accepts a plugin handle, and returns the plugin class.</p>

<p>Here's how you might use that, to call the <code>getDeveloper</code> method in your main plugin class.</p>

<pre><code>craft()-&gt;plugins-&gt;getPlugin('crmPortal')-&gt;getDeveloper();
</code></pre>

CC BY-SA 3.0
2017-04-26T00:53:00.830Z
I want to access the getDeveloper() method in the CrmPortalPlugin.php and print it into the screen
lance adrianne dela cruz
CC BY-SA 3.0
2017-04-26T00:59:45.967Z
What I did was I create a function developerName() in Variable.php and  put the craft()->plugins->getPlugin('crmPortal')->getDeveloper();. And i used it in my template to print it on the screen using {{ craft.crmPortal.developerName() }}
lance adrianne dela cruz
CC BY-SA 3.0
2017-04-26T01:01:50.570Z
Good to hear you got it sorted. If you haven't already done so, I recommend having a read through [the plugin development documentation](https://craftcms.com/docs/plugins/introduction), to understand how the various elements of a plugin work together.
Stephen Lewis
CC BY-SA 3.0
2017-04-26T01:09:59.697Z
Thank you sir . Can you also give me an advice on what to read if i want to make an http request in craft cms?
lance adrianne dela cruz
CC BY-SA 3.0
2017-04-26T01:14:38.320Z
I take it you mean an HTTP request from your plugin to an external site (such as an API)? If so, you should take a look at [Guzzle](http://guzzle3.readthedocs.io/docs.html) (version 3 is a bit out of date, but it's what Craft uses internally, so it's easier to just stick with that).
Stephen Lewis
CC BY-SA 3.0
2017-04-26T01:17:58.197Z
Yes Sir. Thanks . This will be a great help to me
lance adrianne dela cruz
CC BY-SA 3.0
2017-04-25T17:52:20.613Z
2017-04-26T00:09:48.233Z
2017-04-26T00:09:48.233Z
Stephen Lewis
<p>I want to get the developer name from Plugin.php using the getDeveloper() method so I created a function devName() in Variable.php</p>

<pre><code>public function devName() {
    return craft()-&gt;crmPortal-&gt;getDeveloper();
}
</code></pre>

<p>but when i want it to print it in my template, using this <code>{{craft.crmPortal.devName}}</code> I'm having this Error. Property "Craft\WebApp.crmPortal" is not defined.</p>

CC BY-SA 3.0
2017-04-25T08:44:31.650Z
Two things - you're using `devName` and `getName` ... and as I mentioned, it may be a case sensitivity issue - what's the actual class name of your plugin that you've defined?

And you've installed your plugin in setting right?
Jeremy Daalder
CC BY-SA 3.0
2017-04-25T08:55:25.677Z
Yup ! i installed it in plugin settings. the class name in my CrmPortalPlugin.php is => class CrmPortalPlugin
lance adrianne dela cruz
CC BY-SA 3.0
2017-04-25T08:58:34.813Z
Craft\CrmPortalService and its behaviors do not have a method or closure named "getDeveloper". I'm getting this error right now
lance adrianne dela cruz
CC BY-SA 3.0
2017-04-25T08:59:39.933Z
Yes, because you have called the function devName() above...so use `.devName` in your twig code.  All this stuff is very name sensitive.
Jeremy Daalder
CC BY-SA 3.0
2017-04-25T09:01:19.970Z
do i need to right something in services ?
lance adrianne dela cruz
CC BY-SA 3.0
2017-04-25T09:03:45.360Z
You need to implement your function to return that data...which could be via a call to a service, or you could make the developer name a static class var...lots of ways really!
Jeremy Daalder
CC BY-SA 3.0
2017-04-25T09:05:09.573Z
How should i call it on a service . I'm sorry if ask many questions. i'm just a beginner in craft cms
lance adrianne dela cruz
<plugin-development>
Plugin Variable.php Problem
# Plugin Variable.php Problem

(Asked by: username_0 on 2017-04-25)

I want to get the developer name from Plugin.php using the getDeveloper() method so I created a function devName() in Variable.php
public function devName() {
    return craft()->crmPortal->getDeveloper();
}

but when i want it to print it in my template, using this {{craft.crmPortal.devName}} I'm having this Error. Property "Craft\WebApp.crmPortal" is not defined.

**Tags:** plugin-development

> **Comments:**
> **username_1**: Two things - you're using `devName` and `getName` ... and as I mentioned, it may be a case sensitivity issue - what's the actual class name of your plugin that you've defined?  And you've installed your plugin in setting right?  
> **username_0**: Yup ! i installed it in plugin settings. the class name in my CrmPortalPlugin.php is => class CrmPortalPlugin  
> **username_0**: Craft\CrmPortalService and its behaviors do not have a method or closure named "getDeveloper". I'm getting this error right now  
> **username_1**: Yes, because you have called the function devName() above...so use `.devName` in your twig code.  All this stuff is very name sensitive.  
> **username_0**: do i need to right something in services ?  
> **username_1**: You need to implement your function to return that data...which could be via a call to a service, or you could make the developer name a static class var...lots of ways really!  
> **username_0**: How should i call it on a service . I'm sorry if ask many questions. i'm just a beginner in craft cms  

---

## 1 answers

### Answer by username_2 on 2017-04-25. Score: 3 | Accepted answer

It sounds like you're attempting to access the getDeveloper method on your plugin's main service class, but the class doesn't exist.
You have two options:

Create the service class, and implement a getDeveloper method.
Call the getDeveloper method on your main plugin class (which I suspect is what you're really trying to do).

Option One: Service
Your minimal service class will look like this:

Option Two: Plugin
Craft uses Services to expose functionality, in exactly the same way that plugins do. If you're trying to figure out how to do something, just look for a Craft Service with a similar name.
In this case, you want to retrieve your main plugin file, so the PluginsService is a good place to start. We're in luck, it has a getPlugin method, which accepts a plugin handle, and returns the plugin class.
Here's how you might use that, to call the getDeveloper method in your main plugin class.
craft()->plugins->getPlugin('crmPortal')->getDeveloper();

> **Comments:**
> **username_0**: I want to access the getDeveloper() method in the CrmPortalPlugin.php and print it into the screen  
> **username_0**: What I did was I create a function developerName() in Variable.php and  put the craft()->plugins->getPlugin('crmPortal')->getDeveloper();. And i used it in my template to print it on the screen using {{ craft.crmPortal.developerName() }}  
> **username_2**: Good to hear you got it sorted. If you haven't already done so, I recommend having a read through [the plugin development documentation](https://craftcms.com/docs/plugins/introduction), to understand how the various elements of a plugin work together.  
> **username_0**: Thank you sir . Can you also give me an advice on what to read if i want to make an http request in craft cms?  
> **username_2**: I take it you mean an HTTP request from your plugin to an external site (such as an API)? If so, you should take a look at [Guzzle](http://guzzle3.readthedocs.io/docs.html) (version 3 is a bit out of date, but it's what Craft uses internally, so it's easier to just stick with that).  
> **username_0**: Yes Sir. Thanks . This will be a great help to me  

---

