Answers.Body: <p>You seem to have discrepancies in your naming. There is craft-project-name and craftprojectname in there. Could it be that?</p>
  
  <p>Fix the naming and try to delete the plugin row in the database, composer remove it then re install..?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-22T15:58:45.810Z
Answers.LastActivityDate: 2019-01-22T15:58:45.810Z
Answers.UserDisplayName: Oli
Body: <p>I've created my first Craft3 plugin and installed it locally via a composer.json path. After doing the <code>composer require</code>, the plugin showed up as installed (with a green dot) under Admin->Settings->Plugin.</p>
  
  <p>However, the plugin has the following code:</p>
  
  <pre class="lang-php prettyprint-override"><code>$plugins=Craft::$app-&gt;plugins-&gt;getAllPluginInfo();
  error_log('We have version '.$this-&gt;getVersion().' and handle '.$this-&gt;getHandle());
  $plugin=Craft::$app-&gt;plugins-&gt;getPlugin($this-&gt;getHandle());
  if ($plugin==null) {
       error_log('Could not find self');
  } else {
       error_log('Fond self with version: '.$plugin-&gt;getVersion());
  }
  /* @var PluginInterface $plugin */
  foreach ($plugins as $plugin) {
       error_log(json_encode($plugin));
  }
  </code></pre>
  
  <p>calling any page and then checking <code>storage/logs/phperrors.log</code> shows:</p>
  
  <pre><code>22-Jan-2019 13:18:52 Europe/London] We have version 1.0.0 and handle craft-project-name
  [22-Jan-2019 13:18:52 Europe/London] Could not find self
  ...
  [22-Jan-2019 13:18:52 Europe/London] {
  "developer":"myname",
  "developerUrl":"https:\/\/www.example.com",
  "description":"Example plugin",
  "documentationUrl":"https:\/\/www.example.com",
  "class":"rbairwell\\craftprojectname\\Plugin",
  "basePath":"\/Applications\/Dev\/craftcms\/craft-project-name\/src",
  "aliases":{"@rbairwell\/craftprojectname":"\/Applications\/Dev\/craftcms\/vendor\/rbairwell\/craft-project-name\/src"},
  "name":"Craft Project Name",
  "version":"1.0.0",
  "sourceLanguage":"en-US",
  "hasCpSection":false,
  "packageName":"rbairwell\/craft-project-name",
  "isInstalled":true,
  "isEnabled":false,
  "moduleId":"craft-project-name",
  "edition":"standard",
  "hasMultipleEditions":false,
  "hasCpSettings":false,
  "licenseKey":null,
  "licenseKeyStatus":"unknown",
  "licensedEdition":null,
  "licenseIssues":[],
  "isTrial":false,
  "upgradeAvailable":false}
  ...
  </code></pre>
  
  <p>Why is the plugin unable to find itself using <code>getPlugin</code> even though it's confirm it's handle name and why, in the list of plugins does it come up <code>isEnabled: false</code> even though the admin front end shows it as installed+enabled and obviously the plugin is functioning?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-23T03:33:44.390Z
Comments.Text: I'd suggest generating your plugin scaffolding here: https://pluginfactory.io/ and then taking it from there.
Comments.UserDisplayName: andrew.welch
Tags: <plugin-development>
Title: Plugin not fully registered/enabled
ThreadText: # Plugin not fully registered/enabled
  
  (Asked by: username_0 on 2019-01-22)
  
  I've created my first Craft3 plugin and installed it locally via a composer.json path. After doing the `composer require`, the plugin showed up as installed (with a green dot) under Admin->Settings->Plugin.
  
  However, the plugin has the following code:
  
  ```php
  $plugins=Craft::$app->plugins->getAllPluginInfo();
  error_log('We have version '.$this->getVersion().' and handle '.$this->getHandle());
  $plugin=Craft::$app->plugins->getPlugin($this->getHandle());
  if ($plugin==null) {
       error_log('Could not find self');
  } else {
       error_log('Fond self with version: '.$plugin->getVersion());
  }
  /* @var PluginInterface $plugin */
  foreach ($plugins as $plugin) {
       error_log(json_encode($plugin));
  }
  
  ```
  
  calling any page and then checking `storage/logs/phperrors.log` shows:
  
  ```
  22-Jan-2019 13:18:52 Europe/London] We have version 1.0.0 and handle craft-project-name
  [22-Jan-2019 13:18:52 Europe/London] Could not find self
  ...
  [22-Jan-2019 13:18:52 Europe/London] {
  "developer":"myname",
  "developerUrl":"https:\/\/www.example.com",
  "description":"Example plugin",
  "documentationUrl":"https:\/\/www.example.com",
  "class":"rbairwell\\craftprojectname\\Plugin",
  "basePath":"\/Applications\/Dev\/craftcms\/craft-project-name\/src",
  "aliases":{"@rbairwell\/craftprojectname":"\/Applications\/Dev\/craftcms\/vendor\/rbairwell\/craft-project-name\/src"},
  "name":"Craft Project Name",
  "version":"1.0.0",
  "sourceLanguage":"en-US",
  "hasCpSection":false,
  "packageName":"rbairwell\/craft-project-name",
  "isInstalled":true,
  "isEnabled":false,
  "moduleId":"craft-project-name",
  "edition":"standard",
  "hasMultipleEditions":false,
  "hasCpSettings":false,
  "licenseKey":null,
  "licenseKeyStatus":"unknown",
  "licensedEdition":null,
  "licenseIssues":[],
  "isTrial":false,
  "upgradeAvailable":false}
  ...
  
  ```
  
  Why is the plugin unable to find itself using `getPlugin` even though it's confirm it's handle name and why, in the list of plugins does it come up `isEnabled: false` even though the admin front end shows it as installed+enabled and obviously the plugin is functioning?
  
  **Tags:** plugin-development
  
  > **Comments:**
  > **username_1**: I'd suggest generating your plugin scaffolding here: https://pluginfactory.io/ and then taking it from there.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-01-22. Score: 1
  
  You seem to have discrepancies in your naming. There is craft-project-name and craftprojectname in there. Could it be that?
  
  Fix the naming and try to delete the plugin row in the database, composer remove it then re install..?
  
  
  ---
  
  