PHPackages                             rexfordge/x - 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. rexfordge/x

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

rexfordge/x
===========

Some usefull Classes to make working in PHP a little more fluent.

036PHP

Since Jan 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/rexfordkelly-on-php/x)[ Packagist](https://packagist.org/packages/rexfordge/x)[ RSS](/packages/rexfordge-x/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

```
#######################################################################################
###                                                                                 ###
###     RexfordKelly (x) Packages                                                   ###
###     An experiment in making PHP a little more fluent.                           ###
###                                                                                 ###
#######################################################################################

    - xContext
    - xURLFromPath
    - xComposable

#######################################################################################
###                 xContext - Objects with callable properties                     ###
#######################################################################################

    Description and Examples comming soon.

#######################################################################################
###      xURLFromPath - Make working with navigatable paths simpler                 ###
#######################################################################################

    Description and Examples comming soon.

#######################################################################################
###                   xComposable - Composable Configuration Files.                 ###
#######################################################################################

# Examples:

## Simple ( Primatives )

    //... Your Configs file, using composable configurations.

    return [
        'app_root' => __DIR__,
        'app_name' => 'My App',
        'app_version' => '0.0.1',
        'app_loader' => '{{ app_root }}/{{ app_name }}/{{ app_version }}/index.php'
    ];

    //... Bootstraping your configs

    $configs = load_configs( __DIR__ . '/configs.php');

    // $configs ******************************************

        [
            'app_root' => __DIR__,
            'app_name' => 'my_app',
            'app_version' => '0.0.1',
            'app_loader' => '/path/to/app/root/my_app/0.0.1/index.php'
        ]

    // ***************************************************

## Advanced ( Closures, Object, nested arrays )

    NOTE: under the hood we use json_encode/json_decode to perform key
          aspects of the parsing. As such all constructs should be JSON safe.

          We do not recursivly walk complete object/array structures, they are
          left unaltered.

    //... Your Configs file, using composable configurations.

        return [
            'app_root' => __DIR__,
            'app_name' => 'My App',
            'app_version' => '0.0.1',
            'app_loader' => '{{ app_root }}/{{ app_name }}/{{ app_version }}/index.php',
            'echo' => function($scope, $key){
                echo $scope->{$key};
            }
        ];

    //... Bootstraping your configs

    $configs = load_configs( __DIR__ . '/configs.php'); // implicit preserve as array.

    // $configs ******************************************

        [
            'app_root' => __DIR__,
            'app_name' => 'my_app',
            'app_version' => '0.0.1',
            'app_loader' => '/path/to/app/root/my_app/0.0.1/index.php'
            "echo" => object(Closure)
        ]

        USAGE: when preserved as an array.

        $configs['echo']('app_loader') // -> "/path/to/app/root/my_app/0.0.1/index.php"

        USAGE: when trnasformed into Object.

        $configs->echo('app_loader') // -> "/path/to/app/root/my_app/0.0.1/index.php"

    // ***************************************************

## Json files

    {
        "app_name": "{{ app_url }}/{{ app_version }}",
        "app_version": "0.0.1",
        "app_url": "http://www.google.com"
    }

    USAGE: is the same as above.

## txt files

    //---
        John Doe
        Welcome {{ 0 }} to the new world.
        {{1}} You should be see this!
    //---

    As there are no keys just line numbers with text files, substitutions are based on line numbers.
    Of course it's a zero based index.

        $c = X::mount('messages.txt');
        echo $c->{count(get_object_vars($c)) -1}; // -> "Welcome John Doe to the new world. You should be see this!"

    USAGE:

$configs, is an array containing key => value pairs. Where the values may contain
inline placeholders/variables, strings wrapped in "{{ ... }}". Basicly we will loop through
the $configs array, extracting a collection of tokens, and iterativly perform a replacement
with the value returned by looking up the tokens' key within the $configs array.

If there are unknown placeholders/variables, $token keys that don't exist within the $configs
array, we will leave them intact, updating everything else.

Order should not be an issue as all replacments are done globally accross the entire set of
configs, as such the replacments are not done recursivly, once a token has been replaced,
it's been replaced everywhere.

To simplify the code, we employ json decode/encode to transform the array to a string,
replace all the matches, then convert it back to an array. Turns out json_encode/json_decode
are super fast, faster then parsing them ourselves using loops and nested scopes.

```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![rexfordkelly](https://avatars.githubusercontent.com/u/3839452?v=4)](https://github.com/rexfordkelly "rexfordkelly (23 commits)")

### Embed Badge

![Health badge](/badges/rexfordge-x/health.svg)

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

PHPackages © 2026

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