Answers.Body: <p>As of <a href="https://github.com/craftcms/cms/commit/7b31701c9a139bb8078563c86a0698d7f68e35a0" rel="nofollow noreferrer">this commit</a>, there is a <code>Craft::$app-&gt;getVolumes()-&gt;getVolumeByHandle($handle)</code> method you can call.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-17T13:36:11.017Z
Answers.Text: Since Craft 4 uses a total renewed system called FileSystems instead of volumes. Whats the equivalent of this in Craft 4?
Answers.UserDisplayName: Kevon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-07T15:41:23.273Z
Answers.LastActivityDate: 2017-08-07T15:41:23.273Z
Answers.UserDisplayName: Brad Bell
Body: <p>How can I get the details of an asset volume in Craft 3, if I only know the handle?</p>
  
  <p>I found the Volumes and the Assets service, but I believe none of them provides a method for that purpose. The only thing I found was this:</p>
  
  <pre><code>Craft::$app-&gt;getVolumes()-&gt;getVolumeById($id)
  </code></pre>
  
  <p>But how do I get the id? I do not want to iterate over <code>getAllVolumes()</code>... </p>
  
Tags: <plugin-development><craft3><services>
Title: Craft 3: How to get Volume by handle?
ThreadText: # Craft 3: How to get Volume by handle?
  
  (Asked by: username_0 on 2017-08-07)
  
  How can I get the details of an asset volume in Craft 3, if I only know the handle?
  
  I found the Volumes and the Assets service, but I believe none of them provides a method for that purpose. The only thing I found was this:
  
  ```
  Craft::$app->getVolumes()->getVolumeById($id)
  
  ```
  
  But how do I get the id? I do not want to iterate over `getAllVolumes()`...
  
  **Tags:** plugin-development, craft3, services
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-08-07. Score: 3 | Accepted answer
  
  As of [this commit](https://github.com/craftcms/cms/commit/7b31701c9a139bb8078563c86a0698d7f68e35a0), there is a `Craft::$app->getVolumes()->getVolumeByHandle($handle)` method you can call.
  
  > **Comments:**
  > **username_2**: Since Craft 4 uses a total renewed system called FileSystems instead of volumes. Whats the equivalent of this in Craft 4?  
  
  ---
  
  