Download the PHP package silassare/php-utils without Composer

On this page you can find all versions of the php package silassare/php-utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-utils

PHP Utils

A PHP 8.1+ utility library providing reusable components across projects, with strict typing throughout.

Requirements

Installation

Components


Str

PHPUtils\Str — Static string manipulation utilities.


ClassUtils

PHPUtils\ClassUtils — Deep trait introspection with result caching.


FuncUtils

PHPUtils\FuncUtils — Stack-trace caller location.


DotPath

PHPUtils\DotPath — Value object for parsed JS-like dot/bracket path strings.

Supported syntax:

Syntax Example Description
Plain foo.bar Segments matching [a-zA-Z0-9_]+
Bracket integer items[0] Array index access
Bracket quoted map['my.key'] Keys containing dots or special chars

PortablePattern

PHPUtils\PortablePattern — A regular expression PHP (PCRE) and JavaScript read the same way, for a rule declared on the server and checked again in the browser.

The form stays PHP's (<d>body<d>flags), so a pattern already written for preg_match() stays valid. What PCRE has and JavaScript lacks, or reads otherwise, is refused when the pattern is declared, with the reason and the offset: possessive quantifiers, atomic groups, conditionals, recursion, \A, \z, \K, \Q...\E, POSIX classes, \x{...}, octal escapes, script properties, flags other than i, m, s and u, ... toPcre() then runs it as JavaScript runs it: in Unicode mode, $ matching only at the very end of the value (not before a final newline) unless m is set.

Known differences that remain, since the patterns meeting them are rare: \s also matches the Unicode spaces in JavaScript, and . without s also stops at \r, U+2028 and U+2029.


DOM

PHPUtils\DOM\ — Lightweight HTML node builder.


Env

PHPUtils\Env\ — Tokenizing .env file parser and token-level editor.

Parsing

Casting rules:

Editing


Events

PHPUtils\Events\ — Priority-based event system with channels.

Priority levels

Constant Value Description
EventInterface::RUN_FIRST 1 Runs before default listeners
EventInterface::RUN_DEFAULT 2 Default priority
EventInterface::RUN_LAST 3 Runs after all others (reverse registration order)

Usage


Exceptions

PHPUtils\Exceptions\RuntimeException — Rich exception with structured data and suspect tracking.

Suspect helpers:

Method Description
suspect(array) Set raw suspect data
suspectLocation(['file', 'line?', 'start?', 'end?']) Point to a source location
suspectCallable(callable) Record a callable's file/line range
suspectArray(array, ?string $path) Record an array (optionally with a DotPath)
suspectObject(object, ?string $path) Record an object

FS

PHPUtils\FS\ — Filesystem utilities.

PathUtils

PHPUtils\FS\PathUtils — Static path resolution and normalisation.

FSUtils

PHPUtils\FS\FSUtils — Filesystem operations rooted at a base path.

FilesFilter

PHPUtils\FS\FilesFilter — Chainable file finder / filter.


Interfaces

Interface Description
PHPUtils\Interfaces\ArrayCapableInterface Contracts toArray(): array\|ArrayAccess and jsonSerialize().
PHPUtils\Interfaces\MetaCapableInterface Contracts getMeta(): Map, setMetaKey() and mergeMeta().
PHPUtils\Interfaces\RichExceptionInterface Rich exception contract with getData(bool $show_sensitive).
PHPUtils\Lock\Interfaces\LockInterface Lock token contract: acquire(), isAcquired().
PHPUtils\Lock\Interfaces\ReleasableLockInterface Extends LockInterface with release() for reversible locks.
PHPUtils\Lock\Interfaces\LockableInterface Lockable entity contract: getLock(), lock(), unlock(), isLocked(), assertNotLocked().

Lock

PHPUtils\Lock\ — Extensible lock system with support for both releasable and permanent locks.

Design

The lock token (LockInterface) is decoupled from the lockable entity (LockableInterface), so you can inject or share a custom lock implementation without changing the entity class.

Class / Interface Role
Interfaces\LockInterface Token contract: acquire() + isAcquired()
Interfaces\ReleasableLockInterface Extends LockInterface with release() for reversible locks
Interfaces\LockableInterface Entity contract: getLock(), lock(), unlock(), isLocked(), assertNotLocked()
Lock Default in-memory, releasable ReleasableLockInterface implementation
PermanentLock Irreversible LockInterface implementation — no release()
Traits\LockableTrait Default implementation of LockableInterface; override createLock() to inject a custom token
Traits\PermanentlyLockableTrait Variant of LockableTrait using PermanentLock — unlock() always throws

Basic usage

Permanent (irreversible) lock

Shared lock across instances


Traits

Trait Description
PHPUtils\Traits\ArrayCapableTrait Implements jsonSerialize() by delegating to toArray(). Set $json_empty_array_is_object = true to serialize an empty result as {}.
PHPUtils\Lock\Traits\LockableTrait Implements LockableInterface. Override createLock() to inject a custom LockInterface token.
PHPUtils\Lock\Traits\PermanentlyLockableTrait Variant of LockableTrait using PermanentLock by default — unlock() always throws.
PHPUtils\Traits\MetaCapableTrait Implements MetaCapableInterface. Provides getMeta(): Map (lazy), setMetaKey() and mergeMeta(). Guards mutation with assertNotLocked() when the host implements LockableInterface.
PHPUtils\Traits\RichExceptionTrait Full implementation of RichExceptionInterface with suspect tracking.
PHPUtils\Traits\RecordableTrait Records dynamic method calls via __call() and replays them on another object via play($target).

MetaCapableTrait

When the host class implements LockableInterface, both setMetaKey() and mergeMeta() automatically call assertNotLocked().

RecordableTrait


Store

PHPUtils\Store\ — Generic data containers with dot/bracket-notation path access.

Map

PHPUtils\Store\Map — A Store specialised for array<string, mixed> data. Serialises an empty result as {} (JSON object) instead of [].

Store (editable)

StoreNotEditable (read-only)


License

MIT — see LICENSE for details.


All versions of php-utils with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-json Version *
psr/http-message Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package silassare/php-utils contains the following files

Loading the files please wait ...