Download the PHP package eftec/arrayone without Composer

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

ArrayOne

It is a minimalist library that process arrays in PHP with no dependency.

This library is focused to work with business data(reading/saving files, database records, API, etc.), so it is not similar to Numpy, Pandas, NumPHP or alike because they target difference objectives. It is more closely similar to Microsoft PowerQuery and Linq. What it does? Filter, order, renaming column, grouping, validating, amongst many other operations.

Packagist Total Downloads [Maintenance]() [composer]() [php]() [php]() [CocoaPods]()

Basic examples

Getting started

First, you must install the library. You can download this library or use Composer for its installation:

composer require eftec/arrayone

Once the library is installed and included, you can use as:

Concepts

initial operator

Initial operator is the first operator of the chain.

set

It sets the array to be transformed, and it starts the pipeline. It must be the first operator unless you are using the constructor.

setRequest

It sets the initial array readint the values from the request (get/post/header/etc.)
Example:

setJson

It sets the array using a json. Example:

setCsv

It sets the array using a csv. This csv must have a header.
Example:

setCsvHeadless

It sets the array using a head-less csv.
Example:

middle operator

Middle operators are operators that are called between the initial operator set() and the end operator all() or getCurrent(). They do the transformation and they could be stacked.

example:

col

Returns a single column as an array of values.
Example:

columnToIndex

it converts a column into an index
Example:

filter

It filters the values. If the condition is false, then the row is deleted. It uses array_filter()
The indexes are not rebuilt. Example:

You can find an example in examplefindandfilter Note: see validate for more information about conditions.

find

It returns an array with the key and values of the elements that matches the condition.

Example:

It uses the same conditions as filter()

isIndexArray() isIndex()

Returns true if the array is an indexed array. It does not scan the whole array, but instead it only returns true if the index 0 exists, and it is the first value.
Example:

isIndexTableArray() isIndexTable()

It returns true if the value is an indexed array with the first value an array (i.e. a table) Example:

first

It returns the first element of an array.

Example:

indexToCol

It converts the index into a field, and renumerates the array
Example:

npos

It returns the n-position of an array.

removecol

It removes a column
Example:

removerow

It removes the row with the id $rowId. If the row does not exist, then it does nothing Example:

removeFirstRow

It removes the first row or rows. Numeric index could be renumbered. Example:

removeLastRow

It removes the last row or rows Example:

removeDuplicate

This function removes duplicates of a table.
Example:

modCol

It adds or modify a column. Example:

createValidateExample

It creates a validation array using an example

validate

Validate the current array using a comparison table
Example:

Example Using a custom function:

condition description example work example fail expression
not\ negates any comparison, excepting nullable and custom functions. Example: "notint" "hello" 20 notint
nullable the value CAN be a null. If the value is null, then it ignores other validations null nullable
f:\ It calls a custom function defined in the service class. See example "hello" f:test
contain like if a text is contained in "helloworld" "hello" contain;world
alpha if the value is alphabetic "hello" "hello33" alpha
alphanumunder if the value is alphanumeric or under-case "hello_33" "hello!33" alphanumunder
alphanum if the value is alphanumeric "hello33" "hello!33" alphanum
text if the value is a text "hello" true text
regexp if the value match a regular expression. You can't use comma in the regular expression. "abc123" "xyz123" regexp;/abc*/
email if the value is an email "[email protected]" "aaa.bbb.com" email
url if the value is an url https://www.nic.cl "aaaa" url
domain if the value is a domain www.nic.cl "….." domain
minlen the value must have a minimum length "hello" "h" minlen;3
maxlen the value must have a maximum lenght "h" "hello" maxlen;3
betweenlen if the value has a size between "hello" "h" betweenlen;4,5
exist if the value exists "hi" null exist
missing if the value not exist null "hi" missing
req,required if the value is required "hi" null req,required
eq == if the value is equals to 1 0 eq;1
ne != <> if the value is not equals to 1 0 ne;0
null The value MUST be null. It is different to nullable because nullable is a "CAN" null "hello" null
empty if the value is empty "" "hello" empty
lt if the value is less than 1 10 lt;5
lte/le if the value is less or equals than 1 10 lte;5
gt if the value is great than 10 1 gt;5
gte/ge if the value is great or equals than 10 1 gte;5
between if the value is between 5 0 between;4,5
true if the value is true or 1 true false true
false if the value is false, or 0 false true false
array if the value is an array [1,2,3] 1 array
int if the value is an integer 1 "hello" int
string if the value is a string "hello" true string
float if the value is a float 333.3 "hello" float
object if the value is an object new stdClass() 1 object
in the value must be in a list "a" "x" in;a,b,c

end operators

getAll()

Returns the whole array transformed.

Example:

isValid()

returns true if the validation has no error.

Example:

Note: you can also obtain the result of the validation: ->valid($arrayc)->all();
Note2: If you want a simple array with errors, you can use $this::errorStack;

Example:

other methods

Methods that does not fit in the other categories. Those methods are not stackable.

makeValidateArrayByExample

It generates a validate-array using an example array. It could be used by validation() and filter()
Example:

makeRequestArrayByExample

It creates an associative array that could be used to be used by setRequest()
Example:

versions

License

Copyright Jorge Castro Castillo 2023-2024. Licensed under dual license: LGPL-3.0 and commercial license.

In short:


All versions of arrayone with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-ctype Version *
ext-json 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 eftec/arrayone contains the following files

Loading the files please wait ....