Download the PHP package funct/funct without Composer

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

Funct

A PHP library with commonly used code blocks for faster development

Latest Version Build Status Code Coverage Quality Score Total Downloads

Requirements

Installation

Via Composer

Usage

The library consist of five groups: Collection, Invoke, Object, Strings and General. Each group has it's own namespace suffix (Only General uses root namespace).

To include all group functions just include root namespace at the top of the file:

For single group functions you have two options. One is to include root namespace and call directly with full namespace for e.g.:

or to include only single group for e.g.:

If you are using PHP >=5.6 you can include only single function. For e.g.:

General

arrayKeyNotExists($key, array $array)

Checks if the given key or index exists in the array

false($value)

Returns true if value is false

firstValue($valueA)

Returns a first non null value from function arguments

firstValueNotEmpty($valueA, $valueB)

Returns a first not empty value from function arguments

ifSetOr($value, $default)

Return the first param if isset or the second one or null if it doesn't

notEmpty($value)

Returns true if value is not empty

notInArray($needle, $haystack, $strict = null)

Checks if needle is not in array

notNull($value)

Returns true if value is not null

null($value)

Returns true if value is null

tempFile($prefix = 'php')

Generates temp file on systems temp folder with prefix

true($value)

Returns true if value is true

Collection

compact($collection)

Returns a copy of the array with all falsy values removed

countBy($collection, $callback)

Sorts a array into groups and returns a count for the number of objects in each group. Similar to groupBy, but instead of returning a array of values, returns a count for the number of values in that group

every($collection, callable $callback = null)

Returns true if all of the values in the array pass the callback truth test.

findWhere($collection, $value)

Looks through the array and returns the first value that matches all of the key-value pairs listed in properties.

first($collection)

First value of collection

firstN($collection, $n = 1)

flatten($collection, $depth = 1)

Flattens a nested array by depth.

flattenAll($collection)

Flattens all arrays to single level

forEvery($collection, $callable)

Alias of invoke($collection, $callable)

get($collection, $key, $default = null)

Returns item from collection if exists otherwise null or default value

groupBy($collection, $callback)

Splits a collection into sets, grouped by the result of running each value through callback. If callback is a string

initial($collection, $n = 1)

Returns everything but the last entry of the array. Especially useful on the arguments object. Pass n to exclude the

intersection($collectionFirst, $collectionSecond)

Computes the list of values that are the intersection of all the arrays. Each value in the result is present in each

invoke($collection, callable $callback)

Invokes callback on each value in the list. Any extra arguments passed will be forwarded on to the method invocation.

last($collection)

Returns last element of array

lastIndexOf($collection, $value)

Returns the index of the last occurrence of value in the array, or false if value is not present

lastN($collection, $n = 1)

Returns the last element of an array. Passing n will return the last n elements of the array.

maxValue($collection, callable $callback)

Returns the maximum value in collection using callback method

merge(&$a, $b)

Merges all arrays to first array

minValue($collection, callable $callback)

Returns the minimum value in collection using callback method

pairs($collection)

Convert an array into a list of [key, value] pairs.

partition($collection, callable $callback)

Split array into two arrays: one whose elements all satisfy callback and one whose elements all do not satisfy

pluck($collection, $key)

Extract single property from array of arrays

reject($collection, callable $callback)

Returns the values in array without the elements that the truth test callback passes. The opposite of array_filter.

rest($collection, $from = 1)

Returns the rest of the elements in an array. Pass an from to return the values of the array from that index onward.

reverse($collection, $preserveNumericKeys)

Reverses an array.

size($collection, $countRecursive)

Computes the size of a collection, i.e., count all elements in a collection

some($collection, callable $callback = null)

Returns true if any of the values in the array pass the callback truth test.

sortBy($collection, $sortBy, $sortFunction = 'asort')

Returns a sorted array by callback function which should return value to which sort

tail($collection, $from = 1)

Alias of rest($collection, $from = 1)

toJson($collection)

Returns the JSON representation of a collection

union($collectionFirst, $collectionSecond)

Computes the union of the passed-in arrays: the list of unique items, in order, that are present in one or more of

unzip($collection)

The opposite of zip. Given a number of arrays, returns a series of new arrays, the first of which contains all of

where($collection, $value)

Looks through each value in the array, returning an array of all the values that contain all of the key-value pairs

without($collection, $without)

Returns a copy of the array with all instances of the values removed.

zip($collectionFirst, $collectionSecond)

Merges together the values of each of the arrays with the values at the corresponding position.

String

between($input, $left, $right)

Extracts the string between two substrings

camelize($input, $firstLetterUppercase = false)

Camelizes string

chompLeft($input, $prefix)

Removes prefix from start of string

chompRight($input, $suffix)

Removes suffix from end of string

classify($string)

Converts string to camelized class name. First letter is always upper case

collapseWhitespace($input)

Collapse multiple spaces

contains($input, $substring)

Check if string contains substring

countOccurrences($input, $substring)

Count the occurrences of substring in string

dasherize($string)

Converts hyphens and camel casing to dashes

endsWith($input, $substring)

Check if string ends with substring

includes($input, $substring)

Alias of contains

isAlpha($input)

Check if string contains only letters

isAlphaNumeric($input)

Check if string contains only alphanumeric

isLower($input, $mb = false)

Checks if letters in given string are all lowercase.

isNumeric($input)

Check if string contains only digits

isUpper($input, $mb = false)

Checks if letters in given string are all uppercase.

latinize($input)

Remove accents from latin characters

left($string, $n)

Return the substring denoted by n positive left-most characters

len($input, $mb = false)

Alias of length($input, $mb = false);

length($input, $mb = false)

Get string length.

lines($string)

Returns an array with the lines. Cross-platform compatible

lowerCaseFirst($input)

Converts string first char to lowercase

pad($string, $length, $char = ' ')

Pads the string in the center with specified character. char may be a string or a number, defaults is a space

padLeft($input, $length, $char = ' ')

Left pads the string

padRight($input, $length, $char = ' ')

Right pads the string

repeat($input, $n)

Alias times($input, $n)

reverse($input)

Reverses a string

right($string, $n)

Return the substring denoted by n positive right-most characters

slugify($string)

Converts the text into a valid url slug. Removes accents from Latin characters

startsWith($input, $substring)

Check if string starts with substring

strip($string, $string1)

Returns a new string with all occurrences of [string1],[string2],... removed.

stripPunctuation($string)

Strip all of the punctuation

swapCase($string, $mb = false)

Returns a case swapped version of the string

times($input, $n)

Repeat the string n times

titleize($string, array $ignore = [])

Creates a title version of the string. Capitalizes all the words and replaces some characters in the string to

toSentence($array, $delimiter = ', ', $lastDelimiter = ' and ')

Join an array into a human readable sentence

toSentenceSerial($array, $delimiter = ', ', $lastDelimiter = 'and ')

The same as string_to_sentence, but adjusts delimeters to use Serial comma)

toLower($input, $mb = false)

Makes a string lowercase;

toUpper($input, $mb = false)

Makes a string uppercase;

truncate($input, $length, $chars = '…')

Truncate string accounting for word placement and character count

underscore($string)

Converts hyphens and camel casing to underscores

upperCaseFirst($input)

Converts string first char to uppercase

Invoke

ifCondition(callable $callable, $methodArguments = [], $condition)

Invoke a method if condition is true

ifIsset(callable $callable, $values, $key)

Invoke a method if value isset

ifNotEmpty(callable $callable, $var)

Invoke a method if value is not empty

Object

toArray($objects, $valueMethod, $keyMethod = null)

Creates array from objects using valueMethod as value and with/without keyMethod as key

assignIfIsset($object, $property, $array, $key)

Assign value to object from array if key exists

Testing

Contributing

Please see CONDUCT for details.

License

Please see License File for more information.


All versions of funct with dependencies

PHP Build Version
Package Version
No informations.
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 funct/funct contains the following files

Loading the files please wait ....