minibase-app/minilib

A collection of random, quality of life functions for PHP – a sort of kitchen-sink toolbox.

v0.1.1 2021-05-13 04:45 UTC

This package is auto-updated.

Last update: 2024-12-19 02:46:10 UTC


README

Latest Stable Version Latest Unstable Version Test Status

Maintenance Packagist PHP from Packagist composer.lock available license


A collection of random, quality of life functions for PHP – a sort of kitchen-sink toolbox.

Requirements

There are not many requirements for this library; infact, the only true requirement is PHP, but if you plan to contribute, having GNU Make installed will make for nicer dev experience than without.

Installation

Nothing much to do but require the library in your own project's composer dependencies!

$ composer require minibase-app/minilib

Once you have the library installed, head over to the list of available functions to shop around.

Development

  1. Start by cloning the project to your own machine.
  2. Move yourself into the newly cloned repository directory.
  3. Run make to install dev dependencies.
$ git clone https://github.com/minibase-app/minilib.git \
    && cd ./minilib \
    && make vendor \
    && make;

Usage

As mentioned in the Requirements section of this document, having GNU Make installed on your system will make for nice development experience while contributing. To get started, run Make without any targets or arguments:

$ make

And you will be greeted with the list of targets for this project!

Usage:
  make [target] [arg="val"...]

Targets:
  analysis        Run analysis
  help            Show this help message
  repl            Start a REPL instance and interact with the library
  test            Run tests
  vendor          Install vendor dependencies

Try Me

If you're not sure that this library is right for you, can "try before you buy". Start by installing the project for development, and then simply boot up the REPL packaged with the repository!

$ make repl

Using the functions is easy – just make sure that you preface your functions with the projects namespace first.

λ Minibase\is_console() # true
λ Minibase\is_web()     # false

Available Functions

This is a non-exhaustive list – see the src/ directory for a full list!

Array Functions

  • append
  • array_make
  • generate
  • head
  • is_associative
  • only
  • prepend
  • tail
  • wrap

Number Functions

  • between
  • ordinal
  • random_float

Object Functions

N/A

String Functions

  • append
  • camel_case
  • class_basename
  • kebab_case
  • pascal_case
  • prepend
  • snake_case
  • str_random

Miscellaneous Functions

  • blank
  • retry
  • swap
  • tap
  • transform
  • value
  • with