Answers.Body: <p>For Craft 3:</p>
  
  <p><code>Craft::$app-&gt;config-&gt;general-&gt;{var name}</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-29T22:34:33.830Z
Answers.LastActivityDate: 2018-04-29T22:34:33.830Z
Answers.UserDisplayName: Henry
Answers.Body: <pre><code>craft()-&gt;config-&gt;get('JsPath');
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-24T10:26:17.673Z
Answers.LastActivityDate: 2015-09-24T14:00:31.033Z
Answers.LastEditDate: 2015-09-24T14:00:31.033Z
Answers.UserDisplayName: garyconstable
Answers.Body: <p>It is considered best practice to use the public get methods, so while the Craft 3 answer is correct, you should try to get in the habit of calling the methods.</p>
  <pre><code>Craft::$app-&gt;getConfig()-&gt;getGeneral()-&gt;varName
  </code></pre>
  <p>It looks more verbose, but generally best practice and follows the coding guidelines.</p>
  <p><a href="https://craftcms.com/docs/3.x/extend/coding-guidelines.html#app-component-getters" rel="nofollow noreferrer">https://craftcms.com/docs/3.x/extend/coding-guidelines.html#app-component-getters</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-04-22T08:17:32.370Z
Answers.LastActivityDate: 2022-04-24T07:35:16.080Z
Answers.LastEditDate: 2022-04-24T07:35:16.080Z
Answers.UserDisplayName: James White
Body: <p>Within the config folder there is a general.php file with various vars which are site specific. </p>
  
  <p>how do i get at these from within a plugin?</p>
  
  <p>Thanks for your help.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-24T10:26:06.857Z
Comments.Text: its ok i found it - craft()->config->get('JsPath'); for example.
Comments.UserDisplayName: garyconstable
Tags: <config><settings>
Title: How do i get variables from general.php
ThreadText: # How do i get variables from general.php
  
  (Asked by: username_0 on 2015-09-24)
  
  Within the config folder there is a general.php file with various vars which are site specific.
  
  how do i get at these from within a plugin?
  
  Thanks for your help.
  
  **Tags:** config, settings
  
  > **Comments:**
  > **username_0**: its ok i found it - craft()->config->get('JsPath'); for example.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2018-04-29. Score: 8
  
  For Craft 3:
  
  `Craft::$app->config->general->{var name}`
  
  
  ---
  
  ### Answer by username_0 on 2015-09-24. Score: 7
  
  ```
  craft()->config->get('JsPath');
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2022-04-22. Score: 4
  
  It is considered best practice to use the public get methods, so while the Craft 3 answer is correct, you should try to get in the habit of calling the methods.
  
  ```
  Craft::$app->getConfig()->getGeneral()->varName
  
  ```
  
  It looks more verbose, but generally best practice and follows the coding guidelines.
  
  <https://craftcms.com/docs/3.x/extend/coding-guidelines.html#app-component-getters>
  
  
  ---
  
  