PHPackages                             corex/support - 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. corex/support

AbandonedLibrary

corex/support
=============

Support classes and helpers

3.3.4(7y ago)04072MITPHPPHP ^7.1

Since Oct 9Pushed 7y agoCompare

[ Source](https://github.com/corex/support)[ Packagist](https://packagist.org/packages/corex/support)[ RSS](/packages/corex-support/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (5)Versions (41)Used By (2)

CoRex Support
=============

[](#corex-support)

Support classes and helpers. The purpose of this package is to have one package with the most basic classes and helpers available. Some of the code is heavily inspired by Laravel, Yii and other frameworks.

[![License](https://camo.githubusercontent.com/16ec8ebedfcdb3d8b599a9ade7c8e66a386f564d920599db1cf4dd7efa88d445/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f7265782f737570706f72742e737667)](https://camo.githubusercontent.com/16ec8ebedfcdb3d8b599a9ade7c8e66a386f564d920599db1cf4dd7efa88d445/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f7265782f737570706f72742e737667)[![Build Status](https://camo.githubusercontent.com/8d6eb52809b0282213b55f0ddfa639db6c965f7d7f156782d7dc8b6bdfcf209f/68747470733a2f2f7472617669732d63692e6f72672f636f7265782f737570706f72742e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/8d6eb52809b0282213b55f0ddfa639db6c965f7d7f156782d7dc8b6bdfcf209f/68747470733a2f2f7472617669732d63692e6f72672f636f7265782f737570706f72742e7376673f6272616e63683d6d6173746572)[![codecov](https://camo.githubusercontent.com/06286940fa107522ff9fe7fe1f210f439541178d66f7fabf98e09ac98066bfcb/68747470733a2f2f636f6465636f762e696f2f67682f636f7265782f737570706f72742f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://camo.githubusercontent.com/06286940fa107522ff9fe7fe1f210f439541178d66f7fabf98e09ac98066bfcb/68747470733a2f2f636f6465636f762e696f2f67682f636f7265782f737570706f72742f6272616e63682f6d61737465722f67726170682f62616467652e737667)

### System/Cache

[](#systemcache)

Cache.

A few examples.

```
// Generate key based on string + array.
$key = Cache::key('test', ['param1' => 'Something']);

// Set path for cache stores.
Cache::path('/path/cache/stores');

// Set lifetime for cache in seconds.
Cache::lifetime(600);

// Set lifetime for cache in minutes.
Cache::lifetime('60m');

// Set lifetime for cache in hours.
Cache::lifetime('1h');

// Get from cache from 'custom-store'.
$data = Cache::get('test', 'default.value', 'custom-store');

// Put data in cache to 'custom-store'.
Cache::put('test', 'data', 'custom-store');

// Flush cache 'custom-store'.
Cache::flush('custom-store');
```

### System/Console

[](#systemconsole)

Various console helpers.

A few examples.

```
// Writeln text.
Console::writeln('this is a test');

// Writeln texts.
Console::writeln(['this is a test', 'this is line 2']);

// Show header.
Console::header('this is a test');

// Ask question.
$answer = Console::ask('Enter name');

// Enter password.
$password = Console::secret('Enter password');

// Show table.
Console::table($items, ['Header 1', 'Header 2']);

// Throw error (exception).
Console::throwError('this is an error');
```

### System/Directory

[](#systemdirectory)

Various directory helpers.

A few examples.

```
// Test if directory exists.
$exist = Directory::exist('/my/path');

// Check if directory is writeable.
$isWriteable = Directory::isWritable('/my/path');

// Make directory.
Directory::make('/my/path');

// Get entries of a directory.
$entries = Directory::entries('/my/path', '*', true, true, true);
```

### System/File

[](#systemfile)

Various file helpers (i.e. stub, json, etc.)

A few examples.

```
// Check if file exists.
$exist = File::exist($filename);

// Get from file.
$content = File::get($filename);

// Load lines.
$lines = File::getLines($filename);

// Save content.
File::put($filename, $content);

// Save lines.
File::putLines($filename, $lines);

// Get stub.
$stub = File::getStub($filename, [
    'firstname' => 'Roger',
    'lastname' => 'Moore'
]);

// Get template.
$template = File::getTemplate($filename, [
    'firstname' => 'Roger',
    'lastname' => 'Moore'
]);

// Get json.
$array = File::getJson($filename);

// Put json.
File::putJson($filename, $array);

// Get temp filename.
$filename = File::getTempFilename();

// Delete file.
File::delete($filename);
```

### System/Input

[](#systeminput)

Various input helpers to get information from environment.

A few examples.

```
// Get base url.
$baseUrl = Input::getBaseUrl();

// Get user agent.
$userAgent = Input::getUserAgent();

// Get remote address.
$remoteAddress = Input::getRemoteIp();

// Get headers.
$headers = Input::getHeaders();
```

### System/Path

[](#systempath)

Basic path getters (can be used in other packages by overriding getPackagePath()).

A few examples.

```
// Get root of project.
$pathRoot = Path::root();

// Get config-path of project-root.
$pathConfig = Path::root(['config']);

// Get name of package.
$package = Path::packageName();

// Get name of vendor.
$package = Path::vendorName();
```

### System/Session

[](#systemsession)

Session handler.

A few examples.

```
// Set session variable.
Session::set('actor', 'Roger Moore');

// Get session variable.
$actor = Session::get('actor');

// Check if session variable exists.
if (!Session::has('actor')) {
}
```

### System/Token

[](#systemtoken)

Token handler (uses Session handler).

A few examples.

```
// Create csrf token.
$csrfToken = Token::create('csrf');

// Check csrf token.
if (!Token::isValid($csrfToken)) {
}
```

### Arr

[](#arr)

Various array helpers.

A few examples.

```
// Get firstname from array via dot notation.
$firstname = Arr::get($array, 'actor.firstname');

// Set firstname on array via dot notation.
Arr::set($array, 'actor.firstname', $firstname);

// Pluck firstnames from list of actors.
$firstnames = Arr::pluck($actors, 'firstname');
```

### Collection

[](#collection)

Helper for manipulation of elements (collections).

A few examples.

```
// Update each element in collection.
$collection = new Collection($actors);
$collection->each(function (&$actor) {
    $actor->firstname = 'Mr. ' . $actor->firstname;
});

// Get sum of value.
$collection = new Collection($values);
$sum = $collection->sum('amount');

// Loop through actors.
$collection = new Collection($actors);
foreach ($collection => $actor) {
    var_dump($actor->firstname);
};

// Get last element.
$collection = new Collection($actors);
$lastElement = $collection->last();
```

### Bag

[](#bag)

A simple bag structure.

A few examples.

```
// Get json.
$bag = new Bag();
$bag->set('actor.firstname', 'Roger');

// Get firstname of actor using dot notation.
$firstname = $bag->get('actor.firstname');
```

### Base/BaseProperties (abstract)

[](#basebaseproperties-abstract)

Simple abstract class with option to parse array of data which will be parsed to existing properties on class (private, protected and public).

```
class BaseProperties extends \CoRex\Support\Base\BaseProperties
{
    private $privateValue;
    protected $protectedValue;
    public $publicValue;
}
$properties = new BaseProperties([
    'privateValue' => 'something',
    'protectedValue' => 'something',
    'publicValue' => 'something'
]);
```

### Str

[](#str)

Various string helpers (multi-byte).

A few examples.

```
// Get first 4 characters of string.
$left = Str::left($string, 4);

// Check if string starts with 'Test'.
$startsWith = Str::startsWith($string, 'Test');

// Limit text to 20 characters with '...' at the end.
$text = Str::limit($text, 20, '...');

// Replace tokens.
$text = Str::replaceToken($text, [
    'firstname' => 'Roger',
    'lastname' => 'Moore'
]);

// Create a unique string.
$identifier = Str::unique();

// Convert to pascal case.
$data = Convention::pascalCase($data);

// Convert to camel case.
$data = Convention::camelCase($data);

// Convert to snake case.
$data = Convention::snakeCase($data);

// Convert to kebab case.
$data = Convention::kebabCase($data);
```

### StrList

[](#strlist)

Various string list helpers (multi-byte).

A few examples.

```
// Add 'test' to string with separator '|'.
$string = StrList::add($string, 'test', '|');

// Remove 'test' from string.
$string = StrList::remove($string, 'test', '|');

// Check if 'test' exist in string.
$exist = StrList::exist($string, 'test');
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity70

Established project with proven stability

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

Recently: every ~65 days

Total

39

Last Release

2616d ago

Major Versions

1.6.0 → 2.0.02017-06-18

2.5.5 → 3.0.02018-03-28

PHP version history (5 changes)1.0.0PHP &gt;=5.5.9

2.0.0PHP ^7.0

2.0.1PHP &gt;=5.6.4

3.0.0PHP &gt;=7.0

3.3.4PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2168107cb28f49e937f963a925553ebac5923aa27cad2e1cf90ddbcabf663d6d?d=identicon)[corex](/maintainers/corex)

---

Top Contributors

[![corex](https://avatars.githubusercontent.com/u/21259173?v=4)](https://github.com/corex "corex (179 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/corex-support/health.svg)

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

###  Alternatives

[php-debugbar/php-debugbar

Debug bar in the browser for php application

4.4k21.3M40](/packages/php-debugbar-php-debugbar)[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k57.4M685](/packages/drush-drush)[spatie/ignition

A beautiful error page for PHP applications.

510147.6M69](/packages/spatie-ignition)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)

PHPackages © 2026

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