PHPackages                             nacosvel/locator - 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. nacosvel/locator

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

nacosvel/locator
================

Manages multiple instances, handling default selection, creation, caching, and extension.

v3.0.0(3mo ago)011MITPHPPHP ^8.0

Since Dec 9Pushed 3mo agoCompare

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

READMEChangelogDependencies (2)Versions (4)Used By (0)

Locator
=======

[](#locator)

Manages multiple instances, handling default selection, creation, caching, and extension.

[![GitHub Tag](https://camo.githubusercontent.com/675b761589a5eb19f56f8b2810596981a887d0e5927d06432f6b6b59e30572b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f6e61636f7376656c2f6c6f6361746f72)](https://github.com/nacosvel/locator/tags)[![Total Downloads](https://camo.githubusercontent.com/f1dbbac637e61980dc09d0d9cb4173302f7dd1de0fb8986e31d53baedf423770/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e61636f7376656c2f6c6f6361746f723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nacosvel/locator)[![Packagist Version](https://camo.githubusercontent.com/c37c753aa5a81b80d0ef4ce11968a80bd0fcf8fe7a3037665428390ecf408249/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e61636f7376656c2f6c6f6361746f72)](https://packagist.org/packages/nacosvel/locator)[![Packagist PHP Version Support](https://camo.githubusercontent.com/8a1196e31102ecf68418c2273e354e178ccc6a9f32069badfb5d43b45b467fe1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e61636f7376656c2f6c6f6361746f72)](https://github.com/nacosvel/locator)[![Packagist License](https://camo.githubusercontent.com/de51850e01168fc0e86ec8256b12b89db009ebb7f3fa3a82e0f1fc59596103bd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e61636f7376656c2f6c6f6361746f72)](https://github.com/nacosvel/locator)

 Table of Contents1. [Installation](#installation)
2. [Usage](#usage)
3. [Contributing](#contributing)
4. [Contributors](#contributors)
5. [License](#license)

Installation
------------

[](#installation)

You can install the package via [Composer](https://getcomposer.org):

```
composer require nacosvel/locator
```

\[[back to top](#readme-top)\]

Usage
-----

[](#usage)

### Config

[](#config)

```
return [
    'default' => 'alipay',
    'alipay'  => [
        'default'          => '2021004102600103',
        '2021004102600102' => [
            'app_id' => '2021004102600102****',
        ],
        '2021004102600103' => [
            'app_id' => '2021004102600103****',
        ],
    ],
    'wechat'  => [
        'mch_id' => '190000****',
    ],
];
```

### Use Cases

[](#use-cases)

```
use Nacosvel\Locator\Concerns\HasAdapter;
use Nacosvel\Locator\Contracts\Adapter;
use Nacosvel\Locator\MultipleManager;

class Payment implements Adapter
{
    use HasAdapter;

    public function __construct(
        protected string $name,
        protected array $config,
    ) {
        //
    }
}

$config  = require __DIR__ . '/config.php';
$manager = new MultipleManager($config);

$manager->extend('alipay', function (string $name, array $config) {
    return new Payment($name, $config);
});

$manager->extend('wechat', function (string $name, array $config) {
    return new Payment($name, $config);
});

var_dump(
    $manager->instance('alipay')->getName(),
    $manager->instance('alipay')->getDefaultConfig(),
    $manager->instance('alipay')->getConfig(),
    $manager->instance('wechat')->getName(),
    $manager->instance('wechat')->getDefaultConfig(),
    $manager->instance('wechat')->getConfig(),
);
```

Contributing
------------

[](#contributing)

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

\[[back to top](#readme-top)\]

Contributors
------------

[](#contributors)

Thanks goes to these wonderful people:

[ ![contrib.rocks image](https://camo.githubusercontent.com/759bd98deb24cde17f60f25453ec0bb626e979a8ca81ef4ff18e620cf2f7ee0f/68747470733a2f2f636f6e747269622e726f636b732f696d6167653f7265706f3d6e61636f7376656c2f6c6f6361746f72)](https://github.com/nacosvel/locator/graphs/contributors)Contributions of any kind are welcome!

\[[back to top](#readme-top)\]

License
-------

[](#license)

Distributed under the MIT License (MIT). Please see [License File](https://github.com/nacosvel/locator/blob/main/LICENSE) for more information.

\[[back to top](#readme-top)\]

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance81

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~29 days

Total

3

Last Release

100d ago

Major Versions

v1.0.0 → v2.0.02026-02-05

v2.0.0 → v3.0.02026-02-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/2da9b458375a1b7972b7c4d26a5bf8f3e48db305e8805da36f253956f33c5568?d=identicon)[jundayw](/maintainers/jundayw)

---

Top Contributors

[![jundayw](https://avatars.githubusercontent.com/u/16873970?v=4)](https://github.com/jundayw "jundayw (7 commits)")

---

Tags

locatorNacosvel

### Embed Badge

![Health badge](/badges/nacosvel-locator/health.svg)

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

###  Alternatives

[ergebnis/phpstan-rules

Provides rules for phpstan/phpstan.

4428.9M187](/packages/ergebnis-phpstan-rules)[dynamic/silverstripe-locator

SilverStripe Locator Module. Show locations on a map. Search by geoposition.

2113.2k1](/packages/dynamic-silverstripe-locator)

PHPackages © 2026

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