Download the PHP package inanepain/stdlib without Composer

On this page you can find all versions of the php package inanepain/stdlib. 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 stdlib

= inanepain/stdlib image:./icon.png[title=inanepain/stdlib,25] // tag::tagConfig[] :author: Philip Michael Raab :email: [email protected] :description: Common classes that cover a wide range of cases that are used throughout the inanepain libraries. :keywords: inanepain, inane, library, stdlib, json, xml, array, exception, notice, config :copyright: Unlicense :homepage: https://gitgithub.com/inanepain/stdlib :revnumber: 0.10.0 :revdate: 2026-09-07 :experimental: :hide-uri-scheme: :icons: font :source-highlighter: highlight.js :toc: left :sectanchors: :idprefix: topic- :idseparator: - :pkg-vendor: inanepain :pkg-name: stdlib :pkg-id: {pkg-vendor}/{pkg-name} // end::tagConfig[]

== image:./icon.png[title={pkg-id},25] {pkg-id}

{description}

:sectnums:

<<<

:leveloffset: +1

= Install

.composer [source,shell,subs=attributes+]

composer require {pkg-id}

:leveloffset!:

<<<

:leveloffset: +1

= Enum Bitmask

This section documents the BitmaskEnumTrait used to add bitmask (flags) behaviour to backed enums.

== Overview

BitmaskEnumTrait provides a concise API for working with integer bitmasks on PHP 8.5+ backed enums. It enables:

Trait location:

== Requirements and conventions

== API

Static helpers on the enum using the trait:

Instance helpers in an enum case:

NOTE: Internally, hasAny and hasAll use array helpers equivalent to “any”/“all” checks over self::cases().

== Example: Permission flags

The following example shows a typical permission enum using the trait.

.Example: Permissions [source,php]

value

*/

== Extending

To create a new output format, extend AbstractOutput and implement the output() method:

[source,php]

use Inane\Stdlib\Output\AbstractOutput;

class MyCustomOutput extends AbstractOutput { public function output(mixed $inputData = null): string { // Store input and clear cache if required. $this->setInputData($inputData);

    if (!isset($this->outputData)) {
        // ... custom conversion logic ...
        // Store output in cache.
        $this->outputData = "processed data";
    }
    return $this->outputData;
}

}

== Example

A more complete example, using an Output class as a property.

[source,php]

$opt = new \Inane\Stdlib\Options([ 'one' => $data, 'two' => [ 'two' => 2, 'three' => [ 'four' => 'five', ], ], ]);

final class SomeThing { /**

echo "\nREUSABLE:\n"; $thing = new SomeThing($opt); $thing->setOutputHandler(new \Inane\Stdlib\Output\XmlStringOutput()); echo "\nXMLString:\n"; var_dump($thing->output());

$thing->setOutputHandler(new \Inane\Stdlib\Output\XmlOutput()); echo "\nXML:\n"; var_dump($thing->output());

$thing->setOutputHandler(new \Inane\Stdlib\Output\ArrayOutput()); echo "\nARRAY:\n"; var_dump($thing->output());

$thing->setOutputHandler(new \Inane\Stdlib\Output\JsonStringOutput()); echo "\nJSON:\n"; var_dump($thing->output());


:leveloffset!:

<<<

:leveloffset: +1

= Merge

Helper utilities for merging configuration/options arrays and iterators with explicit control over how keys are added and/or updated. The Merge tool lives under Inane\Stdlib\Merge and consists of:

== When to use

Use Merge to combine option sets coming from defaults, environment, per‑user overrides, feature flags, etc. It supports nested structures and works with both PHP arrays and ArrayAccess/Iterator implementations.

== Strategies (MergeMethod)

MergeMethod controls how keys are handled during a merge:

Merging is recursive for nested arrays/objects that are arrays or implement ArrayAccess/Iterator on both source and target sides.

== API overview

Namespace: Inane\Stdlib\Merge

Core static method:

[source,php]

Iterator|array MergeTrait::mergeOptionsWithMethod( MergeMethod $mergeMethod, Iterator|array $target, Iterator|array ...$sources ): Iterator|array

Convenience helpers (static):

Instance method (via Merge or any class using the trait):

[source,php]

public MergeMethod $mergeMethod = MergeMethod::UpdateOnly; // default

public function mergeOptions(Iterator|array $target, Iterator|array ...$sources): Iterator|array

== Usage

=== Static helpers

[source,php]

use Inane\Stdlib\Merge\MergeTrait; // used via Merge facade below use Inane\Stdlib\Merge\Merge;

$defaults = [ 'host' => 'localhost', 'port' => 3306, 'flags' => [ 'compress' => false, 'strict' => true ], ];

$env = [ 'port' => 3307, 'flags' => [ 'compress' => true ], 'extra' => 'ignored in UpdateOnly', ];

// Update existing keys only (default semantics) $merged = Merge::mergeOptionsUpdateOnly($defaults, $env); / Result: [ 'host' => 'localhost', 'port' => 3307, 'flags' => [ 'compress' => true, 'strict' => true ], ] /

// Add missing keys only $added = Merge::mergeOptionsAddOnly($defaults, ['timeout' => 5]); // 'timeout' is appended, existing values untouched

// Add and update (full overlay) $overlay = Merge::mergeOptionsAddAndUpdate($defaults, $env); // Includes 'extra' and applies nested updates php

// Exact hour Clock::fuzzyClock(new DateTime('2026-07-04 13:00:00')); // one o'clock

// Minutes rounded to the nearest five, phrased as past Clock::fuzzyClock(new DateTime('2026-07-04 09:13:00')); // quarter past nine

// After half past, phrased as to the next hour Clock::fuzzyClock(new DateTime('2026-07-04 09:34:00')); // twenty-five to ten

// Rounding up to sixty minutes rolls the hour over Clock::fuzzyClock(new DateTime('2026-07-04 23:58:00')); // twelve o'clock

// Current time Clock::fuzzyClock();

== Tips

:leveloffset!:

<<<

:leveloffset: +1

= ClassUtility

This section documents ClassUtility, a small helper for working out class information without loading the class.

== Overview

ClassUtility inspects PHP source with the tokeniser, so a file can be examined without being included. It provides:

Class location:

== Requirements and conventions

== API

== Example: Class name from a file

[source,php]

<?php declare(strict_types=1);

use Inane\File\File; use Inane\Stdlib\Utility\ClassUtility;

// A namespaced class returns the fully qualified name ClassUtility::getClassFromFile('src/Utility/ClassUtility.php'); // Inane\Stdlib\Utility\ClassUtility

// A File instance works just as well ClassUtility::getClassFromFile(new File('src/Utility/ClassUtility.php')); // Inane\Stdlib\Utility\ClassUtility

// Without a namespace, only the class name comes back ClassUtility::getClassFromFile('legacy/Gamma.php'); // Gamma

// A file with no class declaration ClassUtility::getClassFromFile('config/settings.php'); // null

== Example: Class id

[source,php]

<?php declare(strict_types=1);

use Inane\Stdlib\Utility\ClassUtility;

ClassUtility::classId(1); // classutility ClassUtility::classId(2, '/', false); // Utility/ClassUtility

== Tips

:leveloffset!:

<<<

:leveloffset: +1

= Website: github

++++

github


  ██████████████    ██████████      ██  ████    ████  ██  ██  ██████████████
  ██          ██      ██  ████          ██████████        ██  ██          ██
  ██  ██████  ██  ████  ████  ████████  ██████████████████    ██  ██████  ██
  ██  ██████  ██  ████        ██      ████    ████████  ████  ██  ██████  ██
  ██  ██████  ██    ██      ██  ████    ██  ██                ██  ██████  ██
  ██          ██    ██        ██████    ██    ██  ██          ██          ██
  ██████████████  ██  ██  ██  ██  ██  ██  ██  ██  ██  ██  ██  ██████████████
                      ██    ██████      ██  ██████████  ████
        ████  ████  ██  ████    ██  ██  ██    ██  ████    ██        ████
  ██    ████      ████      ████  ██  ██        ██  ██      ████  ██
  ████    ██████████            ██      ██    ██  ████      ████████      ██
        ████      ████████    ██    ████      ██      ████  ████    ████  ██
  ██  ████  ████  ████  ██  ████    ██    ██              ██  ████  ██  ████
  ██      ████      ████  ██████  ██        ██    ██  ████  ██    ██  ██
            ████      ██████████████    ██████  ██    ████████  ██  ████████
        ██  ██        ██  ██████  ██      ██  ████      ██        ██████  ██
      ████    ██████  ██  ██  ██    ████    ██  ██████        ██      ██  ██
  ██  ██████          ██        ██████  ████████  ██    ██  ██          ██
  ████  ████████  ████████████    ████████    ██████  ████  ██████  ████  ██
    ██  ██      ██  ████    ████  ████  ██  ████  ████  ██████████████  ██
    ██    ████████                  ██  ██      ██    ██  ██████  ██      ██
  ██  ████████    ██    ██  ██████  ████  ██████  ████  ████    ██████
    ██      ████  ██      ██          ██        ██  ██  ██        ██████  ██
  ██    ██  ██      ████    ██  ██    ████  ██      ██  ██████  ██  ████████
    ██  ██████████    ████  ████  ██████    ██████████          ██████
  ██  ██    ██    ██        ██  ██  ██  ██  ████    ████      ██
  ████  ██  ██████    ████  ██████  ████        ████  ████    ████████  ████
  ██  ██████    ████  ██████    ██████████    ████        ████  ██    ██
  ██  ██████  ████  ██    ████  ██████████████    ████  ██████████████
                  ██████  ████████  ██    ██  ██    ██    ██      ██████
  ██████████████  ██      ██████  ██████  ████  ████████  ██  ██  ██████  ██
  ██          ██    ██████    ████    ██            ██  ████      ████  ████
  ██  ██████  ██  ████  ██  ████  ████  ██    ██      ██████████████
  ██  ██████  ██  ██    ██████    ████  ██        ██  ██████  ████  ████
  ██  ██████  ██    ██      ██████████    ██  ████      ████    ████    ████
  ██          ██          ██    ██  ██  ██      ████        ██████  ████████
  ██████████████      ██    ██    ████      ██  ████      ██      ████    ██

++++

:leveloffset!:


All versions of stdlib with dependencies

PHP Build Version
Package Version
Requires php Version >=8.5
psr/container Version *
ext-ctype Version *
ext-intl Version *
ext-libxml Version *
ext-simplexml Version *
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 inanepain/stdlib contains the following files

Loading the files please wait ...