PHPackages                             dynoser/pricefinder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dynoser/pricefinder

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dynoser/pricefinder
===================

Searches a string for values similar to price and returns an array of those

07PHP

Since Dec 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dynoser/pricefinder)[ Packagist](https://packagist.org/packages/dynoser/pricefinder)[ RSS](/packages/dynoser-pricefinder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PriceFinder
===========

[](#pricefinder)

Overview
--------

[](#overview)

`PriceFinder` is a PHP class designed to detect and analyze price information in text strings. It's especially useful for processing multi-currency data, with support for a wide range of global currencies and cryptocurrencies.

Features
--------

[](#features)

- **Currency Support:** The class can recognize and work with a diverse set of currencies, including major ones like USD, EUR, and GBP, along with popular cryptocurrencies like Bitcoin (BTC), Ethereum (ETH), and Dogecoin (DOGE).
- **Flexible Text Analysis:** It can find prices within text strings, even when they're presented in various formats or surrounded by different types of text.
- **Customizable Prefixes and Suffixes:** Users can define their own prefixes and suffixes for price detection, in addition to the default ones provided.
- **Multi-Language Support:** The class recognizes price prefixes in multiple languages, enhancing its usability in international contexts.

How It Works
------------

[](#how-it-works)

1. **Initialization:** The constructor initializes currency codes and symbols, along with default and customizable prefixes and suffixes for price detection.
2. **Price Detection:** The `findPrices` method scans a given text string for price-related patterns, including currency symbols and numeric values.
3. **Currency Recognition:** It determines the currency by analyzing the prefixes, suffixes, and actual symbols used in the text.
4. **Result Compilation:** The method returns an array of detected prices with detailed information like the full matched string, the numeric value, and the identified currency.

Usage Example
-------------

[](#usage-example)

```
$priceFinder = new dynoser\textworks\PriceFinder();
$pricesArr = $priceFinder->findPrices("The price is $100 or €85.33, or 8,000 рублей");
print_r($pricesArr);
// This will return an array with details of the detected prices in USD and EUR:
Array
(
    [0] => Array
        (
            [full_match] => $100 or
            [digits] => 100
            [currency] => USD
            [match_position] => 13
        )

    [1] => Array
        (
            [full_match] => €85.33
            [digits] => 85.33
            [currency] => EUR
            [match_position] => 21
        )

    [2] => Array
        (
            [full_match] => 8,000 рублей
            [digits] => 8000
            [currency] => RUB
            [match_position] => 33
        )
)
```

Customization
-------------

[](#customization)

- **Adding Custom Prefixes/Suffixes:** Users can add their own prefixes or suffixes by passing them as arrays to the constructor or using `setPrefixes` and `setSuffixes` methods.
- **Support for Additional Currencies:** The class can be extended to support more currencies by updating the `$currenciesArr` array.

Limitations
-----------

[](#limitations)

- **Language Dependency:** While the class supports multiple languages, it may require customization for optimal performance in specific linguistic contexts.
- **Complex Formats:** Extremely complex or unconventional price formats might not be detected accurately.

Conclusion
----------

[](#conclusion)

The `PriceFinder` class is a versatile tool for detecting and analyzing prices in text, supporting a wide range of currencies and languages. It is highly customizable, making it suitable for various applications where price data extraction from text is required.

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2576177031670dbafd68b9a03031ca81f0b9e45f0d6244c2cfc2e12cf2d312b9?d=identicon)[dynoser](/maintainers/dynoser)

### Embed Badge

![Health badge](/badges/dynoser-pricefinder/health.svg)

```
[![Health](https://phpackages.com/badges/dynoser-pricefinder/health.svg)](https://phpackages.com/packages/dynoser-pricefinder)
```

###  Alternatives

[yavin/symfony-form-tree

create select field with indentation for tree structure

1591.1k1](/packages/yavin-symfony-form-tree)[spatie/laravel-help-space

Integrate Helpspace in your Laravel app

2333.7k](/packages/spatie-laravel-help-space)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
