I'm developing a set of site-specific custom modules, and one of them depends on the other one being enabled.

I'd like to declare this dependency in the .info.yml file, but the docs only show how to declare dependencies on contrib projects:

Dependencies should be namespaced in the format {project}:{module}, where {project} is the project name as it appears in the Drupal.org URL (e.g. drupal.org/project/views) and {module} is the module's machine name.

How do I declare a dependency on a module that is only found in the local codebase?

  • When creating the namespace of your custom module be sure to avoid those used by projects that are hosted at Drupal.org. As you may have noticed a single project download from Drupal.org may include a few modules. for example the 8.x Chaos tool suite (ctools) project contains three modules: Chaos tools, Chaos tools blocks (Experimental) and Chaos tools Views (Experimental). A dependency of ctools:ctools_block allows you to require the Chaos tools blocks module from within the project. You can also see this when requiring a module from core - drupal:views_ui Commented Aug 28, 2018 at 16:07

2 Answers 2


Try this just like contrib projects.

  - your_module_name
  • 1
    If your project name and module name are the same you can use the shorthand as shown above. Commented Aug 28, 2018 at 15:50
  • 1
    With the addition of dependency namespacing, you should now use your_module_name:your_module_name
    – mbomb007
    Commented Jan 6, 2023 at 17:16

Below is the more specific answer to load specifc library

  - <your_module_name>/<library_name>

Hope this gives an idea to load a specif library from the list of libraries in *.libraries.yml file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.