This is a search engine for the 9902 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 -f: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
- buildForm f:src/Form
- search in form classes only
- hook_schema -f:tests
- exclude test directories
- 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
- \@FormElement\(
- find FormElement annotations
- \@Block\( lang:php
- find Block plugin annotations
- \bdeprecated\b lang:php
- find deprecation notices
Find deprecated code:
- \.once\(
- jQuery
.once(), replaced by the once library in 9.2 - drupal_get_path\(
- deprecated in 9.3, use
ExtensionList::getPath() - format_size\(
- deprecated in 10.2, use
ByteSizeMarkup::create() - renderPlain\( lang:php
- removed in Drupal 12, use
renderInIsolation() - LibraryDiscovery lang:php
- removed in Drupal 12
- views_field_default_views_data\(
- removed in Drupal 12
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 indexed branch (branch:constraintpairs,;-separated; branch names are the indexed git refs)drupal-usage: installs per indexed branch (branch:countpairs,;-separated; same branch names)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