iviphp/support

Common low-level utilities for the IviPHP ecosystem.

Maintainers

Package info

github.com/iviphp/support

pkg:composer/iviphp/support

Transparency log

Statistics

Installs: 7

Dependents: 9

Suggesters: 0

Stars: 2

Open Issues: 0

v0.1.0 2026-07-21 10:48 UTC

This package is not auto-updated.

Last update: 2026-07-21 14:00:21 UTC


README

Common low-level utilities for the IviPHP ecosystem.

Overview

iviphp/support provides small, dependency-free utilities shared across official IviPHP packages.

The package currently includes helpers for:

  • arrays;
  • strings;
  • filesystem paths.

It is designed to remain lightweight, predictable and independent from the full Ivi framework.

Installation

composer require iviphp/support

Requirements

  • PHP 8.2 or later
  • Composer

Array utilities

The Arr class provides common operations for PHP arrays, including nested access through dot notation.

<?php

declare(strict_types=1);

use Ivi\Support\Arr;

$config = [
    'database' => [
        'host' => '127.0.0.1',
        'port' => 3306,
    ],
];

$host = Arr::get($config, 'database.host');

Arr::set($config, 'database.charset', 'utf8mb4');

$exists = Arr::has($config, 'database.port');

Arr::forget($config, 'database.port');

Available methods:

Arr::get($array, $key, $default);
Arr::has($array, $key);
Arr::set($array, $key, $value);
Arr::forget($array, $key);
Arr::only($array, $keys);
Arr::except($array, $keys);

String utilities

The Str class provides common string transformations without external dependencies.

<?php

declare(strict_types=1);

use Ivi\Support\Str;

Str::studly('product_category');
Str::camel('product_category');
Str::snake('ProductCategory');
Str::kebab('ProductCategory');

Str::contains('IviPHP Framework', 'PHP');
Str::startsWith('iviphp/support', 'iviphp');
Str::endsWith('ServiceProvider.php', '.php');

Str::limit('A long description', 10);

Available methods:

Str::contains($value, $needle);
Str::startsWith($value, $prefix);
Str::endsWith($value, $suffix);
Str::studly($value);
Str::camel($value);
Str::snake($value);
Str::kebab($value);
Str::limit($value, $limit, $ending);

Path utilities

The Path class provides portable helpers for joining, normalizing and inspecting filesystem paths.

<?php

declare(strict_types=1);

use Ivi\Support\Path;

$path = Path::join(
    '/var/www',
    'storage',
    'cache'
);

$normalized = Path::normalize($path);

$isAbsolute = Path::isAbsolute($path);

$isInsideStorage = Path::isWithin(
    '/var/www/storage/cache/item.php',
    '/var/www/storage'
);

Available methods:

Path::join(...$segments);
Path::normalize($path);
Path::isAbsolute($path);
Path::basename($path);
Path::dirname($path);
Path::extension($path);
Path::filename($path);
Path::isWithin($path, $base);

Design principles

  • No external dependencies
  • Small and focused utilities
  • Predictable behavior
  • Cross-platform path handling
  • No framework-specific runtime
  • Stable public API

This package must not become a collection of unrelated helpers.

A utility should only be added when it is small, reusable and required by multiple IviPHP components.

Ecosystem

This package is part of the IviPHP ecosystem:

  • iviphp/contracts
  • iviphp/config
  • iviphp/container
  • iviphp/http
  • iviphp/database
  • iviphp/validation
  • iviphp/cache
  • iviphp/view
  • iviphp/framework

Contributing

Contributions should preserve the minimal scope of this package.

Before adding a new utility, it should:

  • solve a common low-level problem;
  • remain independent from framework services;
  • avoid duplicating a reliable native PHP feature without adding clear value;
  • include predictable behavior across supported platforms.

Security

Please report security issues privately to the Softadastra maintainers instead of opening a public issue.

License

This project is licensed under the MIT License.

Maintainer

Created and maintained by Softadastra.