2017 © Pedro Peláez
 

library utilities

Various general purpose utilities

image

geeksareforlife/utilities

Various general purpose utilities

  • Saturday, October 14, 2017
  • by geeksareforlife
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Utilities

Latest Version on Packagist Tests Analysis Code Sniffer Contributor Covenant, (*1)

This small package is simply a collection of functions that I find useful across multiple projects., (*2)

Installation

Install using Composer:, (*3)

composer require geeksareforlife/utilities

The only requirement at this time is PHP 7.1 and above., (*4)

Usage

The package provides static functions grouped into classes. See the list of functions below., (*5)

When using, you can either call the functions using the fully qualified name:, (*6)

$newArray = GeeksAreForLife\Utilities\Arrays::sanitiseArray($array, $keys);

or have a use statement at the top of your file:, (*7)

use GeeksAreForLife\Utilities\Arrays;
...
$newArray = Arrays::sanitiseArray($array, $keys);

Arrays::sanitiseArray($array, $keys)

This function takes two arguments - the array you want to sanitise and a list of keys you want in the returned array., (*8)

For example, given this as an input array:, (*9)

$array = [
  'red'   => 'abc',
  'green' => true,
  'blue'  => [1, 2, 3],
  ];

and the following as the list of keys:, (*10)

$keys = ['red', 'blue', 'yellow'];

The returned array will be:, (*11)

$array = [
  'red'   => 'abc',
  'blue'  => [1, 2, 3],
  ];

Notice that yellow does not appear as a key., (*12)

Arrays::sanitiseArrayList($list, $keys)

This function takes the provided list of arrays and sanitises each one before returning a list of the sanitised arrays., (*13)

The individual arrays are santised in exactly the same way as noted in the previous function., (*14)

Strings::startsWith($string, $startsWith)

This function checks if the provided $string starts with $startsWith and returns either true or false., (*15)

$startsWith can be of any length. An empty string in $startsWith will return true., (*16)

Strings::endsWith($string, $endsWith)

This function checks if the provided $string ends with $endsWith and returns either true or false, (*17)

$endsWith can be of any length. An empty string in $endsWith will return true., (*18)

Contributing

Firstly, I am really happy that you are thinking about contributing to this project., (*19)

You can find the Contributing Guidelines in the root of this repository., (*20)

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms., (*21)

Filing a Bug or Requesting a feature

Both of these are contributing too! You can find details on how to do both in the Contributing Guidelines., (*22)

The Versions

14/10 2017

dev-master

9999999-dev https://github.com/geeksareforlife/utilities

Various general purpose utilities

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

by James Hayward

14/10 2017

0.1.3

0.1.3.0 https://github.com/geeksareforlife/utilities

Various general purpose utilities

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

by James Hayward

14/10 2017

dev-analysis-zOgxd4

dev-analysis-zOgxd4 https://github.com/geeksareforlife/utilities

Various general purpose utilities

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

by James Hayward

14/10 2017

dev-analysis-q2m7Nd

dev-analysis-q2m7Nd https://github.com/geeksareforlife/utilities

Various general purpose utilities

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

by James Hayward

16/04 2017

0.1.2

0.1.2.0 https://github.com/geeksareforlife/utilities

Various general purpose utilities

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

by James Hayward

16/04 2017

0.1.1

0.1.1.0 https://github.com/geeksareforlife/utilities

Various general purpose utilities

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

by James Hayward

16/04 2017

0.1.0

0.1.0.0 https://github.com/geeksareforlife/utilities

Various general purpose utilities

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

by James Hayward