Download the PHP package sevens/vars without Composer
On this page you can find all versions of the php package sevens/vars. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package vars
About SevenVars
=> Simple Variable library Package For Validating, Encoding and Manipulating Strings and Arrays.
=> Seven Vars is developed by Elisha Temiloluwa a.k.a TemmyScope
=> Seven Vars is a library that comes with a Validation Class,
Arrays Manipulation Class and Strings Generation, Encoding, Sanitization & Manipulation Class
=> The Arrays library of the SevenVars Package implements the Countable,
ArrayAccess & Serializable interface(s) of the Standard PHP Library and provides
you a plethora of methods to manipulate an array of arrays i.e. a level II deep array.
=> The Strings Class allows developers encode, manipulate, sanitize and generate truly random strings.
=> The Validation Class takes in an array and rules for validating whether the value assigned to each key
in the array is a valid entry.
Installation
Usage: Seven\Vars\Arrays HOW-TO
In order for the library to generate expected outputs, initialize with a valid array of arrays.
Completely unit tested
- Valid Input Sample
Note: All methods and operations available to objects of the Countable, ArrayAccess and Serializable interfaces are implemented/declared exactly as defined.
- Initialization
- Safe Initialization: From an array of objects E.g. Laravel's Collection
You can always use the safe Initialization when you are not sure of what type of data is contained in your array i.e. array of arrays OR array of objects
- Adding an array to the existing arrays
- Merging array of arrays to the existing one
- Adding an array to each array in the existing array of arrays
- Pop off and return the last array
- Pop off and return an array containing the last key => value in each array
- Shift off and return the first array
- Shift off and return an array containing the first key => value in each array
- Sort based on key: sorts the arrays based on the value attached to the passed key
in ascending order: from smallest to highest
- Sort based on key: sorts the arrays based on the value attached to the passed key
in ascending order: from highest to smallest.
- Sort based on key: sorts the arrays based on the value attached to the passed key
in ascending order: from highest to smallest.
- Last: get the last array from the arrays
- First: get the first array from the arrays
- apply a callable on all the arrays using their keys: alias => map()
An array reference will be passed to your callable and your callable must return the array, else all values will be NULL
- sets a new value for each of the arrays using each of the key -> value pair passed;
if an index is passed, only the key at that array index will be changed
- renames a key in each of the arrays using each of the key -> value pair passed;
* if an index is passed, only the key at that array index will be changed
- delete an array from a collection if it violates a validation rule
- concatenates values of a particular key of multiple arrays using the passed
separator and saving it on the new name
- Extract key from the initial array using the key, value pair in the passed argument
- Extracts all the arrays containing the passed key
- Extracts from all the arrays, if it contains the passed key
- Excludes all array containing the passed key
- Exclude keys from the initial array using the key, value pair in the passed argument
- Exclude keys from the initial array
- Returns an array of arrays from the initial array containing only the keys specified in the argument
- picks out random arrays
* the set size has to be smaller than the total size of the array being processed
- search the value in a key if it contains a certain string
- Returns an array of arrays from the initial array containing only arrays that
values matching those of the keys specified in the argument;
- Returns an array of the size and start position specified
- checks if the key exists in at least one of the arrays
- yields a list-like array containing [index, array] like python enumerate method
- Returns the count of arrays
- checks if the array is empty
- For returning the array at its current state
- For serializing and unserializing
- Return the arrays as JSON ecoded data
- Return the arrays as an iterable array of objects => equivalent to laravel's collection
Usage: Seven\Vars\Strings HOW-TO
Most methods of this class are static, hence do not require initialization Non static methods in this class are used for encoding, encryption and decryption
- Initialization & Usage: If you'd be using the encryption & decryption feature, It's essential
you construct the object passing necessary variables
- Check for the position of a string in another string
- For generating truly random strings
- Several other methods to format, remove and fix HTML tags; generate time From string etc.
Usage: Seven\Vars\Validation HOW-TO
In order for the library to generate expected outputs, always initialize with a valid array. The library comes in handy when dealing with arrays such as $_POST, $_GET etc.
- Initialization
- Validation Rules
- Validation Passed or Failed
- Validation Errors
Returns an array containing the first encountered error.
Returns an empty array, if all the validation rules passed successfully
- Then - Catch Syntax from JavaScript ES6
The callable passed into the "Then" method is called if validation passed.
The catch method is loaded instead if validation failed.
Both Then & Catch accept callables => closure, array callable, function