Created
December 6, 2020 08:46
-
-
Save klaasvw/c3f51e496088d3135180566a5f80f594 to your computer and use it in GitHub Desktop.
Get scheme from URI in Drupal 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$uri = 'public://path/to/file.txt'; | |
/** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */ | |
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager'); | |
$scheme = $stream_wrapper_manager->getScheme($uri); | |
// $scheme = 'public'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment