Module Description
Module Overview Drupal and Composer working together is great for management of external libraries, that can be integrated into Drupal sites. It is a good practice to have the /vendor directory outside the webroot. The problem with moving the vendor out of the webroot however comes when trying to provide public URLs to files in the /vendor directory, such as CSS or JS files that are part of an external library.

This module provides a new stream wrapper, vendor://, that allows for referencing of files in the vendor directory. It works much the same as the private:// file wrapper provided by Drupal core. Along with this stream wrapper, this module sets up *.libraries.yml files to be parsed for vendor:// references, as can be seen in the code below.

example.libraries.yml:

some_library: js: vendor://vendor-name/package-name/js/some_file.js: {} css: theme: vendor://vendor-name/package-name/css/some_file.css: {} The module also provides a helper function, vendor_stream_wrapper_create_url() for resolving vendor files to public facing URLs:

$public_url = vendor_stream_wrapper_create_url('vendor://vendor/package/file.css'); Configuration This module will look first for the vendor first at ./vendor then at ../vendor. If no vendor folder is found, the system will crash. To fix this, set the location of the vendor folder path in settings.php as follows:

$settings['vendor_file_path'] = 'path/to/vendor/folder'; To prevent unwanted behavior (i.e., exposing files without a site owner's knowledge or intention), file/directory patterns should be explicitly provided by navigating to '/admin/config/media/vendor-stream-wrapper'. Indicate the patterns of files/directories located in the vendor directory that should be publically accessible.

Note: by default, no files can be downloaded using example.com/vendor_files/filename.ext, but the ://vendor stream wrapper (within the code) still works as expected.

Project Usage
1174
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to solve the issue of providing public URLs to files in the /vendor directory by creating a new stream wrapper, vendor://, for referencing these files and setting up *.libraries.yml files to be parsed for vendor:// references.
Data Name
vendor_stream_wrapper

OPENAI CHATBOT

OPENAI CHATBOT

11:45:36
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.