Firearm Specs reads the specs of firearms and ammunition from product titles and shows them on your site. Give it "Glock 19 Gen 5 MOS 9mm 4.02in 15rd Pistol" and it shows the model (Glock 19 Gen 5 MOS), the caliber (9×19mm Parabellum), the capacity (15 rounds) and the barrel length (4.02 in). For ammunition it reads the round count and shows the cost per round: "Federal American Eagle 5.56x45mm 55gr FMJ 1000 Rounds" at $449.99 is $0.45 per round.
It is built on the open source title parser of GunsNPrices, a price comparison site for guns and ammunition that uses it to match the same product across 40+ US stores. The parser knows 293 calibers with their retailer spellings and the models of 50 brands, and it runs on your server: the module never sends titles anywhere.
Features
- Firearm specs field formatter: a list of the specs found in a text field (type, brand, model, caliber, caliber type, capacity, barrel length, rounds per box).
- Firearm spec (single value) formatter: one spec, for Views table columns.
- Cost per round formatter for number fields: "$0.45 per round", "$0.45/rd" or "$449.99 ($0.45 per round)". The round count comes from the title, another text field or a number field.
- Firearm Specs for Commerce submodule: the same formatter for Drupal Commerce price fields, with the round count from the variation or product title.
- Barrel lengths in inches, centimeters or millimeters; optional links from caliber names to their price comparison pages (off by default).
- A
firearm_specs()Twig function and afirearm_specs.parserservice. - A settings page where you can try the parser on any title.
Requirements
Drupal 10.3 or 11, PHP 8.1+. The gunsnprices/gunsnprices library (MIT, data CC BY 4.0) is installed by Composer:
composer require drupal/firearm_specs
The Commerce submodule needs Drupal Commerce 3.
Related
- Library source: github.com/gunsnprices/gunsnprices-php
- Current gun and ammo prices: gunsnprices.com
Ask your assistant about Firearm Specs
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- field Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.0 | Stable | 10–11 | PHP 8.1 | Nov 11, 2026 |