Download the PHP package jgswift/qinq without Composer
On this page you can find all versions of the php package jgswift/qinq. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package qinq
qinq
PHP 5.5+ quasi integrated query
Installation
Install via cli using composer:
Install via composer.json using composer:
Description
qinq is a lightweight array handling component that provides support for complex array manipulation with queries and built-in query caching
This package does not parse PHP or do any AST handling. qinq only manipulates arrays using php's built-in array functionality.
Dependency
- php 5.5+
- jgswift/qtil - general utility library
- jgswift/kenum - enumerator implementation
- jgswift/kfiltr - filter/map/hook implementation
Usage
The following is a basic example
Populating a qinq collection
Filter
Map
Applies a callback to the collection elements
Order
Sort
Group
Join
Difference
Computes the difference between collection and argument
Except
Alias of Difference
First
Retrieves first item in collection.
Last
Retrieves last item in collection
Pluck
Aggregate specific array key or object property
From
Replaces entire collection with given arguments. A single array/Iterator/Collection may also be given.
Intersect
Retrieves values that exist in both arrays
Reduce
Reduces array to single value using callback function
Shuffle
Mix all items in collection to new random positions
Values
Retrieves all values from collection
Keys
Retrieves all collection keys
Pack
Removes all data from collection that is weakly equivalent to false or 0
Random
Selects a number of random items from collection
Recursive
Recursive maps through nested collections with a callback function
Search
Search filters through nested collections with a callback function
Selector
Selector filters through nested collections using common string selectors
Flatten
Retrieves every value from a multidimensional collection tree and transforms it into a single dimensional collection
A flag argument may be provided to limit the flattening to certain types of collections or only arrays. The following example will leave the ArrayObject intact and avoid descending into any collections that are not strictly arrays.
Flatten Flags
- Flatten::ARRAYONLY
Flattens strictly php arrays, cancels all other flags
- Flatten::COLLECTION
Flattens objects implementing the qtil Traversable interface
- Flatten::TRAVERSABLE
Flattens objects implementing the built-in php Traversable interface.
- Flatten::ITERATOR
Flattens objects implementing the built-in php Iterator interface
Note: You may combine or exclude flags using
bitwise logic.
The default flatten flag setting descends into any known collection type by default, namely
COLLECTION, TRAVERSABLE, and ITERATOR.
Storing
qinq requires jgswift/delegatr to serialize and store queries.
Note: Query storing relies on eval to unserialize Closures.
Do not rely on users to provide serialized queries to your application as this
can make your application vulnerable to code injection.
You can verify a queries authenticity by performing a cryptographic checksum on
the serialized contents every time a client sends the query.
However said functionality is not implemented in this package.
All versions of qinq with dependencies
jgswift/qtil Version 0.1.*
jgswift/kenum Version 0.1.*
jgswift/kfiltr Version 0.1.*