PHPackages                             functional-php/named-parameters - 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. functional-php/named-parameters

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

functional-php/named-parameters
===============================

Named parameters for functions, methods and constructors.

0.0.2(7y ago)15.8k↓17.9%BSD-3-ClausePHPPHP &gt;=7.1.0

Since Mar 18Pushed 7y ago2 watchersCompare

[ Source](https://github.com/functional-php/named-parameters)[ Packagist](https://packagist.org/packages/functional-php/named-parameters)[ RSS](/packages/functional-php-named-parameters/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Named Parameters
================

[](#named-parameters)

[![Build Status](https://camo.githubusercontent.com/51c08b6c325f5143f9ce3713993ef051369e2e6033d334ff1b44e02c23e2308c/68747470733a2f2f7472617669732d63692e6f72672f66756e6374696f6e616c2d7068702f6e616d65642d706172616d65746572732e737667)](https://travis-ci.org/functional-php/named-parameters)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d147d416cc7343334acb255cb778b1b45020bf438cbdd7275eee805e1425d561/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f66756e6374696f6e616c2d7068702f6e616d65642d706172616d65746572732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/functional-php/named-parameters/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/4e7e610a572c0c28d261a23a84567e85ddf8f099891f9d1f7a64a56b24aabb00/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f66756e6374696f6e616c2d7068702f6e616d65642d706172616d65746572732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/functional-php/named-parameters/?branch=master)[![Average time to resolve an issue](https://camo.githubusercontent.com/2645edec8ae005bff595980cfde6fb92f322f0bb00e60a899e79290dd8d34933/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f7265736f6c7574696f6e2f66756e6374696f6e616c2d7068702f6e616d65642d706172616d65746572732e737667)](http://isitmaintained.com/project/functional-php/named-parameters "Average time to resolve an issue")[![Percentage of issues still open](https://camo.githubusercontent.com/75e7114b979b8701c83ae5d4e2a4c42d30be4d4d099bfedaec4faefcb1d8b350/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f6f70656e2f66756e6374696f6e616c2d7068702f6e616d65642d706172616d65746572732e737667)](http://isitmaintained.com/project/functional-php/named-parameters "Percentage of issues still open")[![Chat on Gitter](https://camo.githubusercontent.com/ef03cfbbd5ec62aaabc567543aab69fdf2c97d9efb7b8374d9aa2cef00a6d912/68747470733a2f2f696d672e736869656c64732e696f2f6769747465722f726f6f6d2f67697474657248512f6769747465722e737667)](https://gitter.im/functional-php)

It is often useful to be able to call a function or methods using named parameters. For example to only pass a different value for the nth default parameter.

PHP does not allow to do that, this library ought to change that.

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

[](#installation)

```
composer require functional-php/named-parameters

```

Basic Usage
-----------

[](#basic-usage)

Say you have the following function:

```
function return_array($a, $b, $c) {
    return [$a, $b, $c];
}

```

Any of the following call is equivalent:

```
use function FunctionalPHP\NamedParameters\call_user_func_array_np;

// traditional call with positional arguments
call_user_func_array_np('return_array', [1, 2, 3]);

// named arguments in the correct order
call_user_func_array_np('return_array', ['a' => 1, 'b' => 2, 'c' => 3]);

// named arguments in random order
call_user_func_array_np('return_array', ['c' => 3, 'a' => 1, 'b' => 2]);
call_user_func_array_np('return_array', ['c' => 3, 'b' => 2, 'a' => 1]);

```

Testing
-------

[](#testing)

You can run the test suite for the library using:

```
composer test

```

A test report will be available in the `reports` directory.

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

[](#contributing)

Any contribution welcome :

- Ideas
- Pull requests
- Issues

Inspiration
-----------

[](#inspiration)

-
-
-
-

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

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 ~0 days

Total

2

Last Release

2618d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c8ef154ac51bf7ac1b506882d7e99d651115d915ad442a6b6629940cec4cb199?d=identicon)[krtek](/maintainers/krtek)

---

Top Contributors

[![krtek4](https://avatars.githubusercontent.com/u/963772?v=4)](https://github.com/krtek4 "krtek4 (5 commits)")

---

Tags

functionmethodsconstructorsnamed-parameters

### Embed Badge

![Health badge](/badges/functional-php-named-parameters/health.svg)

```
[![Health](https://phpackages.com/badges/functional-php-named-parameters/health.svg)](https://phpackages.com/packages/functional-php-named-parameters)
```

###  Alternatives

[danielstjules/stringy

A string manipulation library with multibyte support

2.4k26.0M191](/packages/danielstjules-stringy)[voku/arrayy

Array manipulation library for PHP, called Arrayy!

4875.5M16](/packages/voku-arrayy)[voku/stringy

A string manipulation library with multibyte support

1783.8M19](/packages/voku-stringy)[laravelista/ekko

Framework agnostic PHP package for marking navigation items active.

278673.4k4](/packages/laravelista-ekko)[statamic/stringy

A string manipulation library with multibyte support, forked from @statamic

234.5M14](/packages/statamic-stringy)[rybakit/arguments-resolver

ArgumentsResolver allows you to determine the arguments to pass to a function or method.

26107.7k7](/packages/rybakit-arguments-resolver)

PHPackages © 2026

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