Download the PHP package petrobolos/fixed-array-functions without Composer

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

Fixed Array Functions

Latest Version on Packagist GitHub issues GitHub Tests Action Status GitHub Code Style Action Status Total Downloads GitHub

SplFixedArrays are an implementation of a traditional, bounded array in the PHP standard library.

While they require manual resizing, they're significantly faster than regular arrays or collections when working with large sets of data.

Requirements

Currently, requires PHP 8.3 or above, and Laravel 11+.

Installation

You can install the package via Composer:

Fluent interface

FixedArray is best used with its fluent interface. If you're familiar with Illuminate collections, you'll feel right at home. Provide it an SplFixedArray to get started, or a standard array or collection that will be automatically converted. If you provide any other kind of data, including null, it will be inserted into a new SplFixedArray.

Static methods

You aren't forced to use the fluent interface and can access methods directly by calling them. This is useful if you only need to do one or two operations on a fixed array.

Full list of working methods

Method Description Example
add Alias for push. FixedArray::add('bacon', $arr)
addFrom Add an array or collection of items to an array. FixedArray::addFrom([1, 2, 3], $arr)
contains Checks whether an item exists in a given array. FixedArray::contains('needle', $haystack)
count Returns the number of items in a given array. FixedArray::count($array)
create Creates a new fixed array. FixedArray::create(10)
each Apply a callback to each item in the array without modifying the original. FixedArray::each($array, fn () => var_dump($value))
filter Applies a filter to a given fixed array. FixedArray::filter($array, fn ($value) => $value % 2 === 0)
first Returns the first element of the array. FixedArray::first($array)
fromArray Creates a new fixed array from a standard array. FixedArray::fromArray([1, 2, 3])
fromCollection Creates a new fixed array from an Illuminate collection. FixedArray::fromCollection(collect([1, 2, 3])
getSize Alias for count. FixedArray::getSize($array)
isFixedArray Returns whether a given item is a fixed array. FixedArray::isFixedArray($potentialArray)
last Returns the last element in an array. FixedArray::last($array)
map Applies a callback to each item in the array and returns it. FixedArray::map($array, fn ($value) => (string) $value)
merge Merges given arrays, fixed arrays, or collections into a given fixed array. FixedArray::merge($array, $array2, $array3)
nullify Overwrite all elements in an array with null. FixedArray::nullify($array)
offsetExists Returns whether a given array offset exists. FixedArray::offsetExists(3, $haystack)
offsetGet Retrieves the value at a given array offset. FixedArray::offsetGet(3, $haystack)
offsetNull Replaces the value at a given array offset with null. FixedArray::offsetNull(3, $haystack)
offsetSet Replaces the value at a given array offset with a provided value. FixedArray::offsetSet(3, $value, $haystack)
pop Pops the latest value from the array. FixedArray::pop($array)
push Pushes a given value to the first available space on the array. FixedArray::push($value, $array)
resize Alias for setSize. FixedArray::resize(10, $array)
second Returns the second value from the array. FixedArray::second($array)
setSize Resizes the array to a given size. FixedArray::setSize(10, $array)
toArray Converts a fixed array into a standard array. FixedArray::toArray($array)
toCollection Converts a fixed array into an Illuminate collection. FixedArray::toCollection($array)

Testing

Tests are run using Pest. You can run the suite like so:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

We welcome pull requests, especially those improving the package's optimisation and speed, and new features to bring it into parity with Collection.

Please ensure any functionality submitted has adequate test coverage and documentation (at least in English.)

License

The MIT License (MIT). Please see License File for more information.


All versions of fixed-array-functions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0|^12.0
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 petrobolos/fixed-array-functions contains the following files

Loading the files please wait ....