This is a search engine for the 11898 contributed themes and modules compatible with Drupal 10 and above.
Drupal Contrib Code Search
Details
- Which modules are indexed?
- Modules and theme which support Drupal 10 and later only.
- Which branches are indexed?
- Branches with code compatible with 10 and above.
- How old is the data?
- The code is updated every 48h and release data is updated weekly.
Search code:
- hook_form_alter
- find all implementations of hook_form_alter
- sym:_form_alter
- find symbol definitions containing _form_alter
- hook_form_alter r:webform
- search within the webform module only
- hook_form_alter lang:php
- restrict to PHP files
- "extends PluginBase"
- exact phrase search
- EntityInterface or ContentEntityBase
- match either term
- FormBuilder -test
- find FormBuilder, exclude test files
- Drupal\\views case:yes
- case-sensitive namespace search
- f:\.info\.yml$
- find all module info files
Filter by file & branch:
- hook f:\.module$
- search only in .module files
- render f:src/Plugin
- search in Plugin directories
- schema -f:test -f:vendor
- exclude test and vendor paths
- migrate b:HEAD
- search only in the default branch
Find modules:
- r:views
- list modules whose name contains "views"
- r:commerce -r:stripe
- commerce modules, excluding stripe
- r:field_
- all field-related modules
Regex patterns:
- function .*_schema\(\)
- find all schema hook implementations
- @Form\(
- find Form annotations
- @Block\( lang:php
- find Block plugin annotations
- \bdeprecated\b lang:php
- find deprecation notices
JSON API for scripting
The API is hosted at https://api.tresbien.tech (not on this domain). Two GET endpoints, both return JSON. Important: query terms are regex: escape . ( ) \ with a backslash (e.g. .once( → \.once\().
Step 1: Search code
curl 'https://api.tresbien.tech/v1/search/code?q=\.once\(&num=200'
Returns Result.Files[], each with .Repository (module name) and .ChunkMatches[] (base64 content + match positions). Use num to control max file results.
Step 2: Get repository metadata
curl 'https://api.tresbien.tech/v1/search/repo'
Returns List.Repos[] (all repositories). Each entry has .Repository.Name and .Repository.RawConfig with:
priority: total active installs (string, use for ranking)drupal-core: core compatibility per branch (branch:constraintpairs,;-separated)drupal-usage: installs per branch (branch:countpairs,;-separated)drupal-security:"covered"if covered by Drupal Security Team
Example: find 5 most installed modules using .once(
- Search:
curl 'https://api.tresbien.tech/v1/search/code?q=\.once\(&num=500' - Collect unique
Repositorynames fromResult.Files[] - Fetch:
curl 'https://api.tresbien.tech/v1/search/repo'(full list, no parameters) - For each repo from step 2, look up its
RawConfig.priorityin the repo list - Sort by
prioritydescending, take top 5